Mar 01, 2016, 2:17 AM
[OPEN] [#1271] [3.3.0] Dynamic User Control Assigning Value to Radio in RadioGroup on Page_Load Issue
Hi, I'm currently having issue with dynamic user control.
For example, I have this aspx file:
I checked the json response from the ext.net was like this:
However, this issue doesn't happen when I switch to Ext.NET 1.3 or 1.7
I'm currently doing an upgrade from using Ext.NET 1.3 to Ext.NET 3.3.
I'm not sure if this behavior is expected from the newer version,
but if it is, kindly help how to make it run as it used to.
Thanks.
For example, I have this aspx file:
<form id="form1" runat="server">
<ext:ResourceManager ID="ResourceManager1" runat="server" />
<ext:Button ID="Button_AdvancedSearch" runat="server" Text="Advanced Search" Icon="Find">
<DirectEvents>
<Click OnEvent="Button_Click">
<EventMask ShowMask="true" />
</Click>
</DirectEvents>
</ext:Button>
<ext:Window ID="Window_AdvancedSearch" runat="server" Title="Advanced Search" Icon="Application" Width="475px"
Constrain="true" AutoHeight="true" BodyStyle="background-color: #fff;" Padding="5" Collapsible="true"
Modal="false" Hidden="true" Resizable="false" Draggable="false" InitCenter="false" >
</ext:Window>
</form>
and this User Control:<ext:Radio ID="Radio_Test" runat="server" BoxLabel="Test 1" EnableViewState="false"></ext:Radio>
<ext:RadioGroup ID="Radio_Group" runat="server">
<Items>
<ext:Radio ID="Radio_Option_1" runat="server" BoxLabel="Option 1" EnableViewState="false"></ext:Radio>
<ext:Radio ID="Radio_Option_2" runat="server" BoxLabel="Option 2" EnableViewState="false"></ext:Radio>
</Items>
</ext:RadioGroup>
Now the problem is in the aspx, upon clicking the button, I'm trying to load the user control into the window and show it.protected void Button_Click(object sender, Ext.Net.DirectEventArgs e)
{
WebUserControl1 webUserControl1 = (WebUserControl1)this.LoadControl("WebUserControl1.ascx");
Window_AdvancedSearch.ContentControls.Add(webUserControl1);
Window_AdvancedSearch.UpdateContent();
this.Window_AdvancedSearch.Show();
}
In the user control, on page load I setup the default value:protected void Page_Load(object sender, EventArgs e)
{
this.Radio_Test.Checked = true;
this.Radio_Option_1.Value = true;
}
When I run this and click on the button, javascript error was found : Cannot read property 'setValue' of undefined.I checked the json response from the ext.net was like this:
Ext.suspendLayouts();
App.Window_AdvancedSearch.removeAll();
App.ctl07_Radio_Option_1.setValue(true);
Ext.resumeLayouts(true);
Ext.create("Ext.form.field.Radio",
{"id":"idd1f898709eaf74fa_Radio_Test","
renderTo":"App.idd1f898709eaf74fa_Radio_Test_Container",
"value":false,
"boxLabel":"Test 1",
"inputValue":"App.idd1f898709eaf74fa_Radio_Test"
});
...
Seems like the setValue was called before the Radio control creation.However, this issue doesn't happen when I switch to Ext.NET 1.3 or 1.7
I'm currently doing an upgrade from using Ext.NET 1.3 to Ext.NET 3.3.
I'm not sure if this behavior is expected from the newer version,
but if it is, kindly help how to make it run as it used to.
Thanks.