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

Initiate control update from script

1 Answer 68 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Missing User
Missing User asked on 05 Feb 2009, 12:35 PM
Is it possible to update a dropdown list using ajax but to initiate the update from script and not as a result of some control initiator?

I've read that I should probably use the RadAjaxManager's ajaxRequest client method but then how does this specifically target an update on my dropdown?

Worst case, I could use a CSS-hidden button as initiator and mimic a click on that button from my script but that simply sounds like a cheap hack.

Furthermore, I'm in a master-page scenario so the RadAjaxManager is shared by all the pages and I can't implement page specific server-side code in the AjaxRequest event because I'd need to know from where the request originated (what page, what section of a page, etc) and do the appropriate coding... I just want a simple callback from my script to update a control - shouldn't be so ellaborate I guess

1 Answer, 1 is accepted

Sort by
0
Rosen
Telerik team
answered on 09 Feb 2009, 10:17 AM
Hello Gabriel,

When using RadAjaxManager's ajaxRequest client side method the initiator of the request will be the RadAjaxManager's instance itself. Thus you should set ajaxmanager as initiator and dropdown control as updated control. Similar to the following:

<telerik:RadAjaxManager id="RadAjaxManager1" runat="server">  
  <AjaxSettings> 
     <telerik:AjaxSetting AjaxControlID="RadAjaxManager1">  
        <UpdatedControls> 
           <telerik:AjaxUpdatedControl ControlID="DropDown1"></telerik:AjaxUpdatedControl> 
        </UpdatedControls> 
     </telerik:AjaxSetting> 
   </AjaxSettings> 
</telerik:RadAjaxManager> 

As to your second question. When the AjaxManager is placed on the masterpage you can hook to its AjaxRequest event from the nested page's code behind similar to the following:

RadAjaxManager.GetCurrent(Page).AjaxRequest += new RadAjaxControl.AjaxRequestDelegate(AjaxRequest); 


All the best,
Rosen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Ajax
Asked by
Missing User
Answers by
Rosen
Telerik team
Share this question
or