Using Kendo UI Grid in MVC 4:
I am trying to put a “Edit” button and “Delete” button that will post the model for the row to a controller and action. The Grid should act like a simple list that has an edit and delete button.
@(Html.Kendo().Grid<MyViewModel>()
.Name("Grid")
.Columns(columns =>
{
columns.Bound(p => p.UserLoginId);
columns.Bound(p => p.AppUserName);
columns.Bound(p => p.AppUserStatus);
*** EDIT BUTTON HERE to post row's MyViewModel to new Controller/action ***
*** DELETE BUTTON HERE to post row's MyViewModel to new Controller/action***
})
.DataSource(dataSource => dataSource
.Ajax()
.Read(read => read.Action("SearchUser_Read", "Search"))
))
How would I add these two buttons to each row so that the Grid posted the model to the controller / action?
This is possible only through Ajax. Because even if you surround the Grid with a form tag the form could only post to a single action, you cannot post to different actions depending on the submit button you pressed.
I suggest you to use the standard approaches to Edit the Grid – InLine, Popup and InCell modes.
Or if you want to POST with form submit (without Ajax) to the server use the ServerBinding (like shown in the offline demos) and in the Documentation.