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

how to update controls using javascript from ajaxResponse()

3 Answers 171 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Piyush Bhatt
Top achievements
Rank 2
Piyush Bhatt asked on 24 Feb 2010, 07:20 PM

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?

3 Answers, 1 is accepted

Sort by
0
Iana Tsolova
Telerik team
answered on 25 Feb 2010, 01:32 PM
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.
0
Piyush Bhatt
Top achievements
Rank 2
answered on 25 Feb 2010, 04:14 PM
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?
0
Iana Tsolova
Telerik team
answered on 26 Feb 2010, 04:08 PM
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.
Tags
Ajax
Asked by
Piyush Bhatt
Top achievements
Rank 2
Answers by
Iana Tsolova
Telerik team
Piyush Bhatt
Top achievements
Rank 2
Share this question
or