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

AjaxManager as the triggering control?

2 Answers 69 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Omar
Top achievements
Rank 1
Omar asked on 07 May 2009, 02:22 PM
Hi,
I am new to Telerik suite and i started working on a project where they already been using telerik for a few months, i've read the documentation for the AjaxManager and when i started working on the project, i discovered a strange way of using AjaxManager. and to me it doesnt make sense, could anyone explain what happens when ajax manager is used in the following way? and is it correct way or a horrible error?
the thing to notice here is that the AjaxManager is the triggering control !
could someone please shed some light on what is the consequences of using this? ( and the page is working fine )
<telerik:AjaxManager ID="ioIxRadAjaxManager" runat="server" EnableAJAX="true" OnAjaxRequest="ioIxRadAjaxManager_AjaxRequest"
        <AjaxSettings> 
            <telerik:AjaxSetting AjaxControlID="ioIxRadAjaxManager"
                <UpdatedControls> 
                    <telerik:AjaxUpdatedControl ControlID="ioIxRadGridSGR" /> 
                    <telerik:AjaxUpdatedControl ControlID="ioIxRadGridSGB" /> 
                    <telerik:AjaxUpdatedControl ControlID="ioIxRadGridSGM" /> 
                </UpdatedControls> 
            </telerik:AjaxSetting> 
        </AjaxSettings> 
</telerik:AjaxManager> 

Thank you

2 Answers, 1 is accepted

Sort by
0
ManniAT
Top achievements
Rank 2
answered on 08 May 2009, 09:42 AM
Hi,

I don't know your scenario but I have sometimes the situation where I call ajax function via the manager.
Here a sample snippet from a test project I made for the code library http://www.telerik.com/community/code-library/aspnet-ajax/file-explorer.aspx

    function TellServerAboutSelectedElement(argument) {  
            var ajaxManager = $find("<%= RadAjaxManager.GetCurrent(Page).ClientID %>");  
            ajaxManager.ajaxRequest(argument);  
        } 
This function gets called from some client event handlers.
So there is no "triggering control" - it is a call made through the manager itself.
As a result my Ajax Setting looks like this:
<telerik:RadAjaxManager ID="ramManager" runat="server" DefaultLoadingPanelID="alpPan1" UpdatePanelsRenderMode="Block" RequestQueueSize="10">  
<AjaxSettings> 
    <telerik:AjaxSetting AjaxControlID="ramManager">  
        <UpdatedControls> 
            <telerik:AjaxUpdatedControl ControlID="lblCurDir" /> 
            <telerik:AjaxUpdatedControl ControlID="lblCurFile" /> 
            <telerik:AjaxUpdatedControl ControlID="imgPreview" /> 
            <telerik:AjaxUpdatedControl ControlID="hlDownloadFile" /> 
            <telerik:AjaxUpdatedControl ControlID="hlZIPDir" /> 
        </UpdatedControls> 
    </telerik:AjaxSetting> 
</AjaxSettings> 
</telerik:RadAjaxManager> 
 
Pretty much like your code, isn't it :)

So I guess you are not wrong with what you do.
Maybe (I don't know your solution) you could use specific controls which fire something which results in the update of other controls.
But if it is a case like mine (there is not really a control firing to the server) the manager itself is the triggering control.

By the way - I'm almost sure there is a sample which show this scenario!

Regards

Manfred
0
Omar
Top achievements
Rank 1
answered on 08 May 2009, 10:07 AM
Hi Manfred, thanks for your reply, at least now i know that that method is not a horrible error :)
the scenario that is used here is.
The thing is that i recently started working on this project and i noticed that the other developer before me used this method. and it didnt make sense to me.maybe the guy who wrote these pages (and used this method) was too lazy to open up the AjaxManager dialogue and choose which controls update which controls. so the thing that was solved here is that the whole page is being update (the only gain here is that the page doesnt flicker).
Thanks for your reply as now i know its not an error (its just not good use of Ajax technique). In your case you didnt have a control to fire to the server so thats why you used The manager to post to the server. in my case there are loads of controls that could post to the server (so i guess in my case its just a lazy developer technique)
thanks again for your reply :)
Tags
Ajax
Asked by
Omar
Top achievements
Rank 1
Answers by
ManniAT
Top achievements
Rank 2
Omar
Top achievements
Rank 1
Share this question
or