I'm using the kendo grid to display users. I want to have a button for each user that can be clicked on to link to a page to edit user details.
I have the following code to display the required fields and use the ClientTemplate method to display the button that links to the edit user page.
When the page is rendered in a browser it shows all the columns as expected and the button that I can use to link to the appropriate page. However the grid goes in to limp mode and will not change page, sort or filter.
If I take the following line of code out then the grid works fine.
Am I doing something wrong or is there an alternative way to achieve what I am trying to do?
I have the following code to display the required fields and use the ClientTemplate method to display the button that links to the edit user page.
@(Html.Kendo().Grid<
Extranet.Web.Models.UserListViewModel.UserList
>(Model.Users)
.Name("Grid")
.Columns(columns =>
{
columns.Bound(u => u.UserView.UserName);
columns.Bound(u => u.UserView.Name);
columns.Bound(u => u.UserView.UserRole);
columns.Bound(u => u.UserView.CreatedOn);
columns.Template(@<
button
class
=
"k-button"
value
=
"@Url.Action("
EditUser")/@item.UserView.ID">Edit</
button
>)
.ClientTemplate("<
button
value='" + Url.Action("EditUser", "Admin") + "/#=ID#>Edit</
button
>");
})
.Pageable()
.Filterable()
.Sortable()
.Selectable()
.DataSource(dataSource => dataSource
.Ajax()
.ServerOperation(false)
.Read(read => read.Action("AllUsers", "Admin"))
)
)
If I take the following line of code out then the grid works fine.
columns.Template(@<
button
class
=
"k-button"
value
=
"@Url.Action("
EditUser")/@item.UserView.ID">Edit</
button
>)
.ClientTemplate("<
button
value='" + Url.Action("EditUser", "Admin") + "/#=ID#>Edit</
button
>");