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

Help me understand ajaxRequest and ajaxRequestWithTarget

3 Answers 403 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Chris McGrath
Top achievements
Rank 1
Chris McGrath asked on 23 Jul 2010, 09:05 PM
Hello,

I have a page that I had working with RadAjaxPanels, but I'm trying to re-wire it using RadAjaxManager for the sake of learning how to use that tool properly.

My page has a grid on it that refreshes itself when its command buttons are clicked.  The page also has a popup window, and when the user updates information on the popup window, it calls a refresh() javascript function on my main page, which calls the ajaxRequest function of the RadAjaxPanel, which updates the grid.  This all works great.

Now that I'm trying to re-wire it with a RadAjaxManager, I'm trying to reproduce this functionality.  Unfortunately, the refresh() javascript function that I have now changed to call the RadAjaxManager1.ajaxRequest() function does nothing.  The AjaxRequest code never gets called.

Then I thought maybe if I called ajaxRequestWithTarget and used the grid object as my target, that would produce the correct results.  Unfortunately while I can see that the event is firing because the grid shows the loading panel for a moment, the data is not refreshing.  After looking through all the documentation and examples, I'm confused.  I can't figure out what C# event fires when doing an ajaxRequestWithTarget event.  Nothing in your examples specifies the event to be called.  What grid event gets fired when I use it as the target?

Thanks!

3 Answers, 1 is accepted

Sort by
0
Maria Ilieva
Telerik team
answered on 29 Jul 2010, 08:32 AM
Hello Chris,

Please note that ajaxRequestWithTarget is designed as a substitute of the standard __doPostBack function. Thus, you need to override RaisePostBackEvent of the page in order to get its argument server-side.When you set a control as eventTarget it will raise an AJAX request and will update the controls that it was set to update in the property editor. This function can be handled by the correspondent event handler (i.e. Button_Click) on the server.

Kind regards,
Maria Ilieva
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
Batoha
Top achievements
Rank 1
answered on 24 Aug 2010, 03:50 PM
Hello, Maria.
The subject is still unclear. Could you please provide some examples and explanations?

With respect, Sergey.
0
Cori
Top achievements
Rank 2
answered on 24 Aug 2010, 04:01 PM
I think what Maria is trying to explain is that if you had an AjaxSetting where, for example, a button was setup as the ajax initiator. You could use ajaxRequestWithTarget to raise that AjaxSetting by passing the button as the target and get it to raise it's Click event. Thus, causing the controls it updates in the UpdatedControls collection to be updated.

So pretty much it allows you to raise an ajax request by using one of your existing AjaxSettings, without having the user to raise one that control's events.
Tags
Ajax
Asked by
Chris McGrath
Top achievements
Rank 1
Answers by
Maria Ilieva
Telerik team
Batoha
Top achievements
Rank 1
Cori
Top achievements
Rank 2
Share this question
or