Sep 27, 2012, 6:43 PM
[CLOSED] Calling UserControl Methods from parent form (Javascript)
I have added code to help test my forms (a lot of fields) by filling out default values. My form has fields on the main forms (aspx) and 2 user controls (ascx). Daniil originally helped by answering the question "How can I Call UserControl Methods from parent form.
After following his suggestion and implementing everything, I realized I really wanted to do this from the client side (javascript) instead of the server side. Is there a way to call a javascript funtion on a user control from the main page?
Example Page
Example User Control
After following his suggestion and implementing everything, I realized I really wanted to do this from the client side (javascript) instead of the server side. Is there a way to call a javascript funtion on a user control from the main page?
Example Page
<%@ Page Language="C#" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<script type="text/javascript">
var FilloutTesting = function () {
TextArea.setValue("Hello!");
//How to call other usercontrols to fillout their testing values.
}
</script>
<!DOCTYPE html>
<html>
<head runat="server">
<title>Ext.NET v2 Example</title>
</head>
<body>
<ext:ResourceManager runat="server" />
<ext:UserControlLoader ID="UserControlLoader1" runat="server" Path="TestUC.ascx" />
<ext:TextArea runat="server" ID="TextArea" EmptyText="Please Fill out ..." />
<ext:Button runat="server" Text="Apply defaults">
<Listener>
<Click Fn="FilloutTesting >
</Listener>
</body>
</html>
Example User Control
<%@ Control Language="C#" ClassName="TestUC" %>
<script type="text/javascript">
var FilloutTesting = function () {
Label1.text = "Hello!";
}
</script>
<ext:Label ID="Label1" runat="server" />
Last edited by geoffrey.mcgill; Sep 28, 2012 at 3:44 PM.
Reason: [CLOSED]