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

Ajaxify controls inside repeaters and controls

1 Answer 191 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Luis
Top achievements
Rank 1
Luis asked on 18 Dec 2014, 04:40 AM
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.

1 Answer, 1 is accepted

Sort by
0
Konstantin Dikov
Telerik team
answered on 22 Dec 2014, 01:12 PM
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.

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