Initiate control update from script

2 posts, 0 answers
  1. Gabriel
    Gabriel avatar
    15 posts
    Member since:
    Jun 2008

    Posted 05 Feb 2009 Link to this post

    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

  2. Rosen
    Admin
    Rosen avatar
    3234 posts

    Posted 09 Feb 2009 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top