AxjaxSettings not working in code behind

4 posts, 0 answers
  1. Paul
    Paul avatar
    16 posts
    Member since:
    Mar 2009

    Posted 15 Dec 2009 Link to this post

    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
  2. Johny
    Johny avatar
    80 posts
    Member since:
    Aug 2008

    Posted 16 Dec 2009 Link to this post

    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
  3. Paul
    Paul avatar
    16 posts
    Member since:
    Mar 2009

    Posted 16 Dec 2009 Link to this post

    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
  4. Hus Damen
    Hus Damen avatar
    33 posts
    Member since:
    Dec 2009

    Posted 17 Dec 2009 Link to this post

    Hi Paul,

    I found this link that I think might be helpful:

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

    Thanks.
    Hus
Back to Top