Problem with ajax and Panel

2 posts, 0 answers
  1. Predrag
    Predrag avatar
    4 posts
    Member since:
    Jan 2015

    Posted 26 Feb 2015 Link to this post

    Hi

    I have a problem with AJAX.
    AJAX update field that not specified in configuration. Can you tell me why ajax updated "textbox2" after I change the RadComboBox index?
    (here is a simplified code of my application)


    <telerik:RadAjaxLoadingPanel ID="rlpLoadingPanel" runat="server" Skin="Default" />
        <telerik:RadAjaxManagerProxy ID="RadAjaxManager1" runat="server">
            <AjaxSettings>

                <telerik:AjaxSetting AjaxControlID="cmbTest">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="textBox1" LoadingPanelID="rlpLoadingPanel" />
                    </UpdatedControls>
                </telerik:AjaxSetting>


                <telerik:AjaxSetting AjaxControlID="tButton">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="myPanel1" LoadingPanelID="rlpLoadingPanel" />
                    </UpdatedControls>
                </telerik:AjaxSetting>

            </AjaxSettings>
        </telerik:RadAjaxManagerProxy>

        <asp:Panel runat="server" ID="myPanel1">

            <telerik:RadComboBox ID="cmbTest" runat="server" AutoPostBack="true" OnSelectedIndexChanged="cmbTest_SelectedIndexChanged">
                <Items>
                    <telerik:RadComboBoxItem runat="server" Text="test 1" />
                    <telerik:RadComboBoxItem runat="server" Text="test 2" />
                    <telerik:RadComboBoxItem runat="server" Text="test 3" />
                    <telerik:RadComboBoxItem runat="server" Text="test 4" />
                    <telerik:RadComboBoxItem runat="server" Text="test 5" />
                    <telerik:RadComboBoxItem runat="server" Text="test 6" />
                    <telerik:RadComboBoxItem runat="server" Text="test 7" />
                </Items>
            </telerik:RadComboBox>
            <br />
            <br />
            <telerik:RadTextBox runat="server" ID="textBox1"></telerik:RadTextBox>
            <br />
            <telerik:RadTextBox runat="server" ID="textBox2"></telerik:RadTextBox>
        </asp:Panel>

        <asp:Panel runat="server" ID="myPanel2">
            <telerik:RadButton runat="server" ID="tButton" OnClick="tButton_Click" Text="Button"></telerik:RadButton>
        </asp:Panel>




    This is code on server side

            protected void cmbTest_SelectedIndexChanged(object sender, Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs e)
            {            
                textBox1.Text = "textValue1";
                textBox2.Text = "textValue2";
            }


    Whne I move

    <telerik:AjaxSetting AjaxControlID="tButton">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="myPanel1" LoadingPanelID="rlpLoadingPanel" />
                    </UpdatedControls>
                </telerik:AjaxSetting>

    from my ajax configuration everythis is work normal. I dont understand the link between this and changing the RadComboBox index. Why "myPanel1" have inbluence on this?
  2. Konstantin Dikov
    Admin
    Konstantin Dikov avatar
    1800 posts

    Posted 03 Mar 2015 Link to this post

    Hello Predrag,

    The behavior that you are observing is due to the fact that the AJAX will be enabled for all controls specified in the AJAX settings of the RadAjaxManager. Since your myPanel1 is wrapping the textBox1 control, this will lead to the behavior that you are observing.

    For getting the desired behavior with your current settings, you will need to set the UpdateInitiatorPanelsOnly property of your RadAjaxManager to true:
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" UpdateInitiatorPanelsOnly="true">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="cmbTest">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="textBox1" LoadingPanelID="rlpLoadingPanel" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="tButton">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="myPanel1" LoadingPanelID="rlpLoadingPanel" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>

    Detailed information on this matter is available in the following help article:
    Hope this helps.


    Regards,
    Konstantin Dikov
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top