Hi,
I'm new to Telerik, and there's a lot about MVC that I'm still learning, so apologies in advance.
I have a Grid Control that I'm passing an object to (see code below). I want a detail page which is a little complex and beyond the scope of what a popup would handle, so a separate page is necessary.
I'm really struggling to get a "Select" button working to send route value out, something like /Person/Details/5
The grid itself is working as expected, however I can't seem to invoke a route or action based on the current selected row or invoke an action on the select button.
I've written a comment in the actual section I'm having a problem with.
Thanks
@(Html.Kendo().Grid(Model)
.Name(
"grid"
)
.Columns(columns =>
{
columns.Bound(p => p.person.Title).Width(100);
columns.Bound(p => p.person.Firstname);
columns.Bound(p => p.person.Firstname);
columns.Bound(p => p.person.Surname);
columns.Bound(p => p.person.ABN).Width(210);
columns.Bound(p => p.person.PracticeCode);
columns.Bound(p => p.currentform);
columns.Command(command => { command.Edit(); });
columns.Command(command => { command.Destroy(); });
columns.Command(command => { command.Select(); });
})
.Sortable()
.ToolBar(commands => commands.Create())
.Editable(editable => editable.Mode(GridEditMode.PopUp))
.DataSource(dataSource => dataSource
.Server()
.Model(model => model.Id(p => p.person.pkey))
.Create(create => create.Action(
"Create"
,
"Person"
))
// I'm having trouble with this next line.
// All I want is the drkey to be a route value
// Obviously, this doesn't work because you can't put a lamba in the anonymous type, but how do you do it ?
.Read(read => read.Action(
"Details"
,
"Person"
,
new
{ id = (p => p.person.pkey) } ))
.Update(update => update.Action(
"Update"
,
"Person"
))
.Destroy(destroy => destroy.Action(
"Destroy"
,
"Person"
))