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

Problem with ajax and Panel

1 Answer 37 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Predrag
Top achievements
Rank 1
Predrag asked on 26 Feb 2015, 07:47 AM
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?

1 Answer, 1 is accepted

Sort by
0
Konstantin Dikov
Telerik team
answered on 03 Mar 2015, 08:38 AM
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.

 
Tags
Ajax
Asked by
Predrag
Top achievements
Rank 1
Answers by
Konstantin Dikov
Telerik team
Share this question
or