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

[Solved] RadAjaxManager for multiple controls

5 Answers 334 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Daron
Top achievements
Rank 1
Daron asked on 30 Jan 2008, 06:00 PM
Hello colleagues,

I have a RadAjaxManager on my form and several (3 at the moment) RadGrids. When a row of any of the grids is clicked it needs to make an ajax call to update several parts of the page.

The way I have been achieving this (up until now, when I've had a single grid) is to utilise the OnRowClick client-side event of RadGrid and call a js function that triggers RadAjaxManager's 'AjaxRequest' event, triggering a call to server-side code.

The problem I have is that if I call this method, how will I know which grid was selected? The 'sender' argument appears to be the RadAjaxManager itself and not a reference to the appropriate grid.

Any ideas? Or do I need an ajaxmanager for each grid?

Cheers,
Daron

5 Answers, 1 is accepted

Sort by
0
Sebastian
Telerik team
answered on 01 Feb 2008, 03:18 PM
Hello Daron,

Even when using single OnRowClick handler for the three grids the sender argument inside that method should be the grid instance which has been clicked. In support of my statement I prepared a small demo project (attached to this message).

Best regards,
Stephen
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Daron
Top achievements
Rank 1
answered on 06 Feb 2008, 12:04 PM
Thanks for your reply Stephen, but the client-side events are not what I'm struggling with. I can tell which grid was clicked perfectly fine.

My problem arises in the server-side call to RadAjaxManager's "AjaxRequest" event. How do I re-use the same RadAjaxManager for multiple grids when the value of the sender argument is the RadAjaxManager itself?

I need an answer to this quite urgently as it's a bit of a showstopper at the moment.

Cheers
0
Sebastian
Telerik team
answered on 06 Feb 2008, 12:15 PM
Hello Daron,

Thank you for the clarification - I see your point more clearly now.

To determine the grid which is the "initiator" of the ajax request in this case I suggest you pass a unique argument to the ajaxRequest method of the manager which to identify it. Then parse this argument inside the AjaxRequest handler of the ajax manager and you should be able to determine the grid which started the request.

More about the ajaxRequest method of RadAjaxManager Prometheus you can learn from the bottom section of this documentation topic:

http://www.telerik.com/help/radcontrols/prometheus/?ajxAJAXManager.html

Best regards,
Stephen
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Daron
Top achievements
Rank 1
answered on 06 Feb 2008, 06:09 PM
I "hacked together" a solution by concatenating the grid's id with the row that was selected, eg, "radgrdid1|23" and sending that as the argument to the "AjaxRequest" method. Not happy at all with this, but it works.

This is a definite shortcoming of your RadAjaxManager. One of the input parameters should definitely be something like "initiatingControl" so you know who fired the request. Otherwise (unless you hack together a dirty fix like I did) the AjaxManager is next to useless..
0
Accepted
Sebastian
Telerik team
answered on 07 Feb 2008, 08:23 AM
Hello Daron,

Thank you for your suggestion - I will forward it to our developers for further consideration. If this appears to be a common request and an attainable enhancement, you may see it included in a future version of the product.

At this point consider the solution explained in my previous reply, I hope it is feasible although not elegant enough for your configuration. 

Best regards,
Stephen
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Ajax
Asked by
Daron
Top achievements
Rank 1
Answers by
Sebastian
Telerik team
Daron
Top achievements
Rank 1
Share this question
or