Hi
I have a page that dynamically creates some radio button controls. I am also trying to get them to work with RadAjax.
I have setup similar buttons in the aspx file and they do as I want. Please let me know what I have done wrong.
In the code behind the CheckedChanged code does not run, and instead it does a complete page postback.
Aspx code.
| <asp:Content ID="Content3" ContentPlaceHolderID="BOMContent" runat="server"> |
| <telerik:RadAjaxManagerProxy ID="RadAjaxManagerProxy1" runat="server"> |
| <AjaxSettings> |
| <telerik:AjaxSetting AjaxControlID="Continue"> |
| <UpdatedControls> |
| <telerik:AjaxUpdatedControl ControlID="BOMTable" |
| LoadingPanelID="BOMTableLoading" /> |
| </UpdatedControls> |
| </telerik:AjaxSetting> |
| <telerik:AjaxSetting AjaxControlID="RadioButton1"> |
| <UpdatedControls> |
| <telerik:AjaxUpdatedControl ControlID="RadioButton1" /> |
| <telerik:AjaxUpdatedControl ControlID="RadioButton2" /> |
| </UpdatedControls> |
| </telerik:AjaxSetting> |
| <telerik:AjaxSetting AjaxControlID="RadioButton2"> |
| <UpdatedControls> |
| <telerik:AjaxUpdatedControl ControlID="RadioButton1" /> |
| <telerik:AjaxUpdatedControl ControlID="RadioButton2" /> |
| </UpdatedControls> |
| </telerik:AjaxSetting> |
| <telerik:AjaxSetting AjaxControlID="CheckBox1"> |
| <UpdatedControls> |
| <telerik:AjaxUpdatedControl ControlID="CheckBox1" /> |
| <telerik:AjaxUpdatedControl ControlID="CheckBox2" /> |
| </UpdatedControls> |
| </telerik:AjaxSetting> |
| <telerik:AjaxSetting AjaxControlID="CheckBox2"> |
| <UpdatedControls> |
| <telerik:AjaxUpdatedControl ControlID="CheckBox1" /> |
| <telerik:AjaxUpdatedControl ControlID="CheckBox2" /> |
| </UpdatedControls> |
| </telerik:AjaxSetting> |
| </AjaxSettings> |
| </telerik:RadAjaxManagerProxy> |
| <telerik:RadAjaxLoadingPanel ID="BOMPanelLoading" runat="server" /> |
| <telerik:RadAjaxLoadingPanel ID="BOMTableLoading" runat="server" /> |
| <telerik:RadWindowManager ID="RadWindowManager1" runat="server"> |
| </telerik:RadWindowManager> |
| <telerik:RadAjaxPanel ID="BOMHeaderPanel" runat="server" LoadingPanelID="RadAjaxLoadingPanel1"> |
| <asp:Label ID="FullNameLabel" runat="server" Text="FullName"></asp:Label> |
| <br /> |
| </telerik:RadAjaxPanel> |
| <telerik:RadAjaxPanel ID="BOMTablePanel" runat="server" LoadingPanelID="RadAjaxLoadingPanel1" |
| Width="860" BorderStyle="None"> |
| <asp:Table ID="BOMTable" runat="server" EnableViewState="true"> |
| </asp:Table> |
| <asp:Button ID="goBackButton" runat="server" Text="Go Back" OnClick="goBackButton_Click"> |
| </asp:Button> |
| <asp:Button ID="Continue" runat="server" Text="Continue" OnClick="Continue_Click"> |
| </asp:Button> |
| <asp:RadioButton ID="RadioButton1" runat="server" AutoPostBack="True" |
| oncheckedchanged="RadioButton1_CheckedChanged" GroupName="rbTest" /> |
| <asp:RadioButton ID="RadioButton2" runat="server" GroupName="rbTest" |
| oncheckedchanged="RadioButton1_CheckedChanged" AutoPostBack="True" /> |
| <asp:CheckBox ID="CheckBox1" runat="server" AutoPostBack="True" |
| oncheckedchanged="CheckBox1_CheckedChanged" /> |
| <asp:CheckBox ID="CheckBox2" runat="server" AutoPostBack="True" |
| oncheckedchanged="CheckBox1_CheckedChanged" /></telerik:RadAjaxPanel> |
| </asp:Content> |
Code snippets from the code behind.
| RadioButton radioButton = new RadioButton(); |
| radioButton.ID = heading.Replace(" ", "").Replace("-", ""); |
| radioButton.GroupName = optionHeading.Replace(" ", ""); |
| radioButton.Text = " " + heading; |
| radioButton.ToolTip = toolTip; |
| radioButton.EnableViewState = true; |
| radioButton.AutoPostBack = true; |
| radioButton.CheckedChanged += new EventHandler(radioButton_CheckedChanged); |
| tc.Controls.Add(radioButton); |
| AjaxSetting rbSetting = new AjaxSetting(); |
| rbSetting.AjaxControlID = radioButton.ID; |
| AjaxUpdatedControl rbControl = new AjaxUpdatedControl(); |
| rbControl.ControlID = radioButton.ID; |
| rbSetting.UpdatedControls.Add(rbControl); |
| RadAjaxManagerProxy1.AjaxSettings.Add(rbSetting); |
| void radioButton_CheckedChanged(object sender, EventArgs e) |
| { |
| throw new NotImplementedException(); |
| } |
Thanks for the help.
Paul