This is a migrated thread and some comments may be shown as answers.

[Solved] AxjaxSettings not working in code behind

3 Answers 188 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Paul
Top achievements
Rank 2
Paul asked on 16 Dec 2009, 03:25 AM
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

3 Answers, 1 is accepted

Sort by
0
Johny
Top achievements
Rank 1
answered on 16 Dec 2009, 02:18 PM
Hi Paul,

I noticed that you ajax-ify some controls (like "Continue" button) through RadAjaxmanager and RadajaxPanel at the same time. But this link says this is not recommended:

http://www.telerik.com/help/aspnet-ajax/ajxcontrolsinajaxpanelandajaxsettings.html

I hope this helps.
Johny
0
Paul
Top achievements
Rank 2
answered on 16 Dec 2009, 06:59 PM
Hi Johny

Thanks for the reply I made the changes but it changed nothing.

I am pretty sure it is in the code behind code, I have missed something or set something wrong.

Paul
0
Hus Damen
Top achievements
Rank 1
answered on 17 Dec 2009, 02:50 PM
Hi Paul,

I found this link that I think might be helpful:

http://www.telerik.com/help/aspnet-ajax/ajxmasterpageupdateeverywhere.html

Thanks.
Hus
Tags
Ajax
Asked by
Paul
Top achievements
Rank 2
Answers by
Johny
Top achievements
Rank 1
Paul
Top achievements
Rank 2
Hus Damen
Top achievements
Rank 1
Share this question
or