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

Grid Edit Mode and Row Select

5 Answers 59 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jason
Top achievements
Rank 1
Jason asked on 22 Mar 2011, 11:54 PM
Hi,

How can I disable client side row selection when the grid is in edit mode?

Thanks,
J

5 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 1
answered on 23 Mar 2011, 05:53 AM
Hello Jason,

You can try the following code snippet to disable row selection when grid is in edit mode.

ASPX:
<ClientSettings Selecting-AllowRowSelect="true" EnablePostBackOnRowClick="false">
    <ClientEvents OnRowSelecting="OnRowSelecting" />
</ClientSettings>

C#:
<script type="text/javascript">
     function OnRowSelecting(sender, args) {
        var editIndex = sender._editIndexes[0];
        if (editIndex > -1) {
            args.set_cancel(true);
        }
    }
 </script>

Thanks,
Princy.
0
Andrew
Top achievements
Rank 1
answered on 29 Oct 2012, 02:25 PM
What does ._editIndexes[0]; refer to in your code snipplet?
0
Princy
Top achievements
Rank 1
answered on 30 Oct 2012, 05:30 AM
Hi,

You can find which items are in edit mode using the _editIndexes array. It contains the indexes of those items.  _editIndexes[0] will index of the first edit item.

Thanks,
Princy.
0
Andrew
Top achievements
Rank 1
answered on 30 Oct 2012, 12:13 PM
Thanks for the reply.  But I do not see an event for OnRowSelecting that takes both sender and args.  From the documentation on the site I only see OnRowSelect that takes an argument of e.

http://demos.telerik.com/aspnet-mvc/razor/grid/clientsideevents

When debugging I do not see _editIndexes[0] in the passed in argument.  Any help is greatly appricated.

Baiscly, I need to determine if the row is in edit mode, because when a row is selected in the grid, an ajax event is fired.  When the row is in edit mode, this event throws a server error.

Thanks,
Andrew
0
Princy
Top achievements
Rank 1
answered on 31 Oct 2012, 08:50 AM
Hi Andrew,

Please post the questions in Telerik MVC Extensions for getting details about ASP.NET MVC  grid clientside events.

Thanks,
Princy.
Tags
Grid
Asked by
Jason
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 1
Andrew
Top achievements
Rank 1
Share this question
or