I am re-wiring a grid from traditional MVC to use a Telerik Grid and have a grid that appears not to be requesting data from the controller:
Controller:
GIven this is non-Ajax I'd expect the Grid to 'read' the datasource upon initial rendering, but a breakpoint in the first line of 'UserRolesRead' is never hit and the Grid is rendered empty.
Anyone any ideas?
Thanks
@ModelType EditUserViewModel
@Code
ViewData("Title") = "UserRoles"
End Code
<
h2
>Roles for user: @Model.UserName</
h2
>
<
hr
/>
@Using (Html.BeginForm("UserRoles", "Account", FormMethod.Post, New With {.encType = "multipart/form-data", .name = "myform"}))
@Html.AntiForgeryToken()
@(Html.Kendo().Grid(Of SelectRoleEditorViewModel).Name("Roles") _
.Columns(Sub(c)
c.Bound(Function(x) x.Selected)
c.Bound(Function(x) x.RoleName)
c.Bound(Function(x) x.Description)
End Sub) _
.Editable(Function(editable) editable.Mode(GridEditMode.InLine)) _
.DataSource(Function(dataSource) dataSource _
.Server() _
.Model(Sub(model) model.Id(Function(p) p.RoleName)) _
.Read(Function(read) read.Action("UserRolesRead", "Account", New With {.id = Model.id}))) _
.Pageable())
Controller:
Public
Function
UserRolesRead(req
As
DataSourceRequest, id
As
String
)
As
ActionResult
Dim
Db =
New
ApplicationDbContext()
Dim
user = Db.Users.First(
Function
(u) u.Id = id)
Dim
model
As
New
List(Of SelectRoleEditorViewModel)()
model = user.Roles
Return
View(model)
End
Function
GIven this is non-Ajax I'd expect the Grid to 'read' the datasource upon initial rendering, but a breakpoint in the first line of 'UserRolesRead' is never hit and the Grid is rendered empty.
Anyone any ideas?
Thanks