how to update controls using javascript from ajaxResponse()

4 posts, 0 answers
  1. Piyush Bhatt
    Piyush Bhatt avatar
    166 posts
    Member since:
    Nov 2007

    Posted 24 Feb 2010 Link to this post


    I have some scenarios where I have to use AjaxManager.ajaxRequest() for various purposes. As per the documentation, after ajaxRequest(), whatever controls I am expecting to update should be put inside the AjaxManager's ajaxSetting.

    <AjaxSettings>

    <telerik:AjaxSetting AjaxControlID="RadAjaxManager1">

    <UpdatedControls>
    ....

     

    <telerik:AjaxUpdatedControl ControlID="pnlButtons" />

    <telerik:AjaxUpdatedControl ControlID="ucQueryFieldSelector" />

    ....
    </UpdatedControls>

    But I want to use ajaxRequest() with different parameter arguments, sometimes updating one set of control and sometimes updating some other set of controls. For above example, I may want to update pnlButtons sometime and then only ucQueryFieldSelector in some other case.

    Are there any javascript calls that we can use to update particular Control after ajax response is received?

  2. Iana Tsolova
    Admin
    Iana Tsolova avatar
    3388 posts

    Posted 25 Feb 2010 Link to this post

    Hello Piyush,

    As all the controls are added to the same ajax setting UpdatedControls collection, all of them would be refreshed on every ajax request invoked with the ajaxRequest() method.
    To overcome this behavior by adding different ajax settings with different set of updated controls and for initiator control, add a real ajax initiator but the RadAjaxManager. Then you can invoke ajax requests manually with the ajaxRequestWithTarget() method instead.
    Please find more information on how to achieve that here.

    Give it a try and let me know how it goes.

    Sincerely yours,
    Iana
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Piyush Bhatt
    Piyush Bhatt avatar
    166 posts
    Member since:
    Nov 2007

    Posted 25 Feb 2010 Link to this post

    That could be one scenario. But what I wanted was some feature, where I don't have to add anything inside AjaxManager. I just want to call makeAjaxRequest() and then after response, I want to call some Javascript methods to update any control I need.

    For example, when the AjaxSettings are

    <AjaxSettings AjaxControlId="someControl">
    <UpdateControls>
       <AjaxUpdateControl ControlId="targetControl" />
    </UpdateControls>
    </..>

    Here internally AjaxManager knows that when there is an event from [SomeControl], it got to update [targetControl] and this part it must be doing via some Javascript calls.

    How to achieve the same thing via Javascript if I wanted to do it myself. I am ok declaring the AjaxManager on the page. But I want to programmatically decide what controls to update at response time. Do you think this is possible?
  5. Iana Tsolova
    Admin
    Iana Tsolova avatar
    3388 posts

    Posted 26 Feb 2010 Link to this post

    Hi Piyush,

    Please find attached a sample project illustrating how you can update different controls based on the different ajaxRequest() method arguments.
    Note that the different controls are in different settings.

    Best wishes,
    Iana
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Back to Top