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

Expand/Collapse Button

1 Answer 118 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Mustapha
Top achievements
Rank 1
Mustapha asked on 23 Dec 2011, 04:27 PM
Hello,

I am using hierarchical grid with load mode set to ServerOnDemand. I would like to know if it is possible to modify the onclick javascript function for the Expand button while grid is binding.

For example, I would like to pass argument in the function call below:

onclick="javascript:__doPostBack('18_userControl$RadGridDiscounts$ctl00$ctl04$GECBtnExpandColumn','')"

Or if I can set the argument in the ajax request.

Regards,
Mustapha

1 Answer, 1 is accepted

Sort by
0
Andrey
Telerik team
answered on 28 Dec 2011, 11:34 AM
Hi Mustapha,

You could not modify the arguments of the  __doPostback function because this will broke the life cycle of the RadGrid control.

However you could achieve your goal by attaching a custom event handler to the OnClientClick event of the Expand/Collapse button in RadGrid. When attaching the handler you should pass a parameter to this function the index of the item in which the button resides. Then in the JavaScript function you need to fire an Ajax request and to pass the index to the Ajax request. Then based on this index you should expand the item with the same index on the server.

I have made sample project to illustrate this approach. Give this project a try and check whether this is the desired behavior.


Regards,
Andrey
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
Tags
Grid
Asked by
Mustapha
Top achievements
Rank 1
Answers by
Andrey
Telerik team
Share this question
or