8 Answers, 1 is accepted
Currently the MVC grid does not support multi-row selection. You can disable selection only server side like this:
.Selectable(settings => settings.Enabled(false))
Atanas Korchev
the Telerik team
Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>
I get the following error every time I added that property to the grid: "The DataKeys collection is empty. Please specify a data key."
Here's a snippet of code from my test project:
<%: Html.Telerik().Grid(Model) _
.Name("Orders") _
.Columns(Function(columns)
columns.Bound(Function(o) o.OrderID)
columns.Bound(Function(o) o.ShipAddress)
columns.Bound(Function(o) o.RequiredDate)
End Function) _
.Pageable() _
.Sortable() _
.Selectable(Function(s)
s.Enabled(True)
End Function) _
.ClientEvents(Function(events)
events.OnRowSelect("onRowSelected")
End Function)
%>
As the exception says you need to define a datakey in order to enable grid selection:
.DataKeys(Sub (keys) keys.Add(Function(o) o.OrderID) End Sub)
Atanas Korchev
the Telerik team
Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>
Ok, on to question number two. Does the grid support multiple row selection?
Does the grid support hierarchical grids (aka nested grids)?
No, multiple row selection is not supported. Perhaps you can use checkboxes instead?
Yes, nested grids are supported. Please check this example.
Atanas Korchev
the Telerik team
Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>
Hmm, I'm not sure checkboxes will fly or not. I'll see how it turns out.
A couple more questions for you.
Can you hide columns pre-display? What I mean is can I include a column in the list of columns but set it's visibility to hidden in the grid definition? If so can you still access the hidden column(s) values on client-side events?
Can I override a column's value at runtime? We have several columns which contain integer values to represent enums. We'd like to be able to turn the integer values into something more meaningful like a imagine with mouse-over text.
You can either make columns Hidden() or use the dataItem JavaScript method to retrieve column values on the client-side. If you decide to use hidden columns make them appear last in the column list. IE has problems with hidden table columns when they are not last.
You can change the display of the column using templates. Please check the client and server template examples.
Atanas Korchev
the Telerik team
Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>