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

OnCommand and EnablePostBackOnRowClick bug?

4 Answers 134 Views
Grid
This is a migrated thread and some comments may be shown as answers.
blablabla
Top achievements
Rank 1
blablabla asked on 16 Jan 2012, 03:37 PM
Hi,

I noticed that when I set the EnablePostBackOnRowClick property to true in the ClientSettings of the RadGrid, the client event OnCommand is not fired when the command is "RowClick". The server-side event is fired w/o any issues.

When the EnablePostBackOnRowClick property is set to false, OnCommand is fired fine on the client side when i click a row.

Is this a bug or is it intended behavior?

Thank you.

4 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 17 Jan 2012, 05:47 AM
Hello,

The client event OnCommand will be raised for each grid command which is about to be triggered i.e sorting, paging, filtering, editing, etc. EnablePostBackOnRowClick property allows a postback/ajax request which will be started automatically depending on whether the control has been ajaxified. In the ItemCommand event handler, you can check for the CommandName as "e.CommandName" is equal to "RowClick".

-Shinu.
0
blablabla
Top achievements
Rank 1
answered on 17 Jan 2012, 09:59 AM
Hey Shinu,

I understand that I can check the CommandName in the ItemCommand event handler, but that's not the issue.

When I click on a row, the client side event OnCommand is not fired when I have EnablePostBackOnRowClick set to true. If I set it to false, then the client side event OnCommand is fired. Is this a normal thing?

I ask because when I click on a Row, I need to be able to show a RadConfirm in some cases, and thus need to cancel the event before the postback occurs.
0
Accepted
Marin
Telerik team
answered on 18 Jan 2012, 11:30 AM
Hello,

 Yes this is expected behavior. Moreover the OnCommand client-side event is intended for handling grid commands mainly in the case of client-side binding. If you need additional processing before the postback you can try the RowClick client-side event.

All the best,
Marin
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
0
blablabla
Top achievements
Rank 1
answered on 19 Jan 2012, 03:36 PM
Thanks. I tried using the RowClick clientEvent, but you can't cancel it, which means I can't use a RadConfirm, so no dice. Thanks anyways.
Tags
Grid
Asked by
blablabla
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
blablabla
Top achievements
Rank 1
Marin
Telerik team
Share this question
or