RadAjaxManager to update related control only on certain triggering control event

2 posts, 0 answers
  1. Anar
    Anar avatar
    5 posts
    Member since:
    Apr 2009

    Posted 10 Dec 2011 Link to this post

    Hello,

    I have a radgrid on my form and several text and combo boxes.
    My intent is to update related boxes as soon as radgrid selection changes.
    For that I use RadAjaxManager and set relations like
    <telerik:AjaxSetting AjaxControlID="rgMain">
               <UpdatedControls>
                   <telerik:AjaxUpdatedControl ControlID="rtbEmployeeName" />
                   <telerik:AjaxUpdatedControl ControlID="cbEmployeeActive" />
                   <telerik:AjaxUpdatedControl ControlID="rtbHomePhone" />
                   <telerik:AjaxUpdatedControl ControlID="rtbMobilePhone" />
                   <telerik:AjaxUpdatedControl ControlID="rcbPosition" />
               </UpdatedControls>
           </telerik:AjaxSetting>

    After that I process SelectedIndexChanged event in code-behind and get updated controls on client side - everything is OK.

    However, when I use paging or sorting built-in into Radgrid it again triggers the update of the controls. I only would like them to update on selection change, not on page change or sort.
    Is there a way to filter which events of a master control should trigger ajax updates of related controls ?

    Thanks for your attention.
  2. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 12 Dec 2011 Link to this post

    Hi Anar,

    One possible approach in this case is toe use partial Ajaxification as shown in the following online demo.

    Another approach is to use asp UpdatePanel and set EventName for specific AsyncPostBackTrigger. For example:
    <asp:UpdatePanel ID="UpdatePanel1" runat="server"
        <ContentTemplate>
            <asp:Panel ID="Panel1" runat="server"
    //Controls you need to update here
            </asp:Panel>
        </ContentTemplate>
        <Triggers>
            <asp:AsyncPostBackTrigger ControlID="RadGrid1" EventName="SelectedIndexChanged" />
        </Triggers>
    </asp:UpdatePanel>
    <asp:UpdatePanel ID="UpdatePanel2" runat="server"
        <ContentTemplate>
            <telerik:RadGrid ID="RadGrid1" runat="server"
            </telerik:RadGrid>
        </ContentTemplate>
        <Triggers>
            <asp:AsyncPostBackTrigger ControlID="RadGrid1" EventName="PageIndexChanged" />
        </Triggers>
    </asp:UpdatePanel>

    I hope this helps.

    All the best,
    Maria Ilieva
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
Back to Top