Ajaxify controls inside repeaters and controls

2 posts, 0 answers
  1. Luis
    Luis avatar
    6 posts
    Member since:
    Dec 2014

    Posted 17 Dec 2014 Link to this post

    Hello there,

    I read the following threads about how to ajaxify controls inside repeaters. But I can't still solve my problem.

    http://www.telerik.com/forums/radcalender-inside-repeater---events-not-working
    http://www.telerik.com/forums/correct-way-to-ajaxify-controls-inside-a-repeater-that-rebind-a-second-repeater
    http://www.telerik.com/forums/ajaxify-controls-inside-a-repeater
    http://www.telerik.com/forums/cannot-ajaxify-button-inside-the-repeater

    Basically my architecture is like this:

    ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    ---MasterPage
                  <Telerik:RadScriptManager ID="radScriptManager" runat="server" AsyncPostBackTimeout="300" />

                <Telerik:RadAjaxManager ID="RadAjaxManager" runat="server" RestoreOriginalRenderDelegate="false" EnablePageHeadUpdate="false" DefaultLoadingPanelID="pnlAjaxLoadingPanel" UpdatePanelsRenderMode="Inline">
                    <AjaxSettings>
                        <Telerik:AjaxSetting AjaxControlID="pnlTest">
                            <UpdatedControls>
                                <Telerik:AjaxUpdatedControl ControlID="pnlTest" />
                            </UpdatedControls>
                        </Telerik:AjaxSetting>
                    </AjaxSettings>
                </Telerik:RadAjaxManager>

       --- MyPage
           <Telerik:RadAjaxManagerProxy ID="RadAjaxManagerProxy" runat="server">
               <AjaxSettings>
                   <Telerik:AjaxSetting AjaxControlID="pnlMain">
                       <UpdatedControls>
                           <Telerik:AjaxUpdatedControl ControlID="pnlMain" />
                       </UpdatedControls>
                   </Telerik:AjaxSetting>
                   <Telerik:AjaxSetting AjaxControlID="linkbutton1">
                       <UpdatedControls>
                           <Telerik:AjaxUpdatedControl ControlID="pnlMain" />
                           <Telerik:AjaxUpdatedControl ControlID="repeater1" />
                           <Telerik:AjaxUpdatedControl ControlID="repeater2" />
                       </UpdatedControls>
                   </Telerik:AjaxSetting>
               </AjaxSettings>
           </Telerik:RadAjaxManagerProxy>
         ---Panel id=pnlMain
             ---UserControl1 id=ctrl1
                  ---Repeater1 id=repeater1
                       ---UserControl2 id=ctrl2
                           ---Repeater id=repeater2
                              ---LinkButton id=linkbutton1
      
    -------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    It's a little bit complicated what I'm trying to do. The thing is when I click on my linkbutton1, it performs like a postback (most like a glitch) and nothing happens. I need to do second click to make it work. It has always this behavior whether I add the ajax setting or not.

    So, I traced the code with a breakpoint and everything works with the first postback on server side but the on the client side it only reacts on the second postback.

    How can I add the ajax setting to my linkbutton1 refreshes efectively the main panel section(pnlMain) from the MyPage where I declared the ajax settings with Rad Ajax Manager Proxy.

    Thanks.
  2. Konstantin Dikov
    Admin
    Konstantin Dikov avatar
    1793 posts

    Posted 22 Dec 2014 Link to this post

    Hello Luis,

    When you include the "pnlMain" in the AJAX settings, all nested controls will be with enabled AJAX and you do not need to include them in the settings. Furthermore, the controls placed in the Repeater control will not be accessible through their ID in this manner and the only possible way to include them in the AJAX settings will be a programmatic approach from the code-behind, as documented in the following help article:
    In your scenario, the easiest way to enable AJAX for your pnlMain Panel would be to remove the following form the AJAX settings:
    <Telerik:AjaxSetting AjaxControlID="linkbutton1">
                       <UpdatedControls>
                           <Telerik:AjaxUpdatedControl ControlID="pnlMain" />
                           <Telerik:AjaxUpdatedControl ControlID="repeater1" />
                           <Telerik:AjaxUpdatedControl ControlID="repeater2" />
                       </UpdatedControls>
                   </Telerik:AjaxSetting>

    And you should end up with the following:
    <Telerik:RadAjaxManagerProxy ID="RadAjaxManagerProxy" runat="server">
        <AjaxSettings>
            <Telerik:AjaxSetting AjaxControlID="pnlMain">
                <UpdatedControls>
                    <Telerik:AjaxUpdatedControl ControlID="pnlMain" />
                </UpdatedControls>
            </Telerik:AjaxSetting>       
        </AjaxSettings>
    </Telerik:RadAjaxManagerProxy>

    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