I am trying to port a Telerik MVC extentions view to a KendoUI view and I am running into a problem.
The view has a grid and a client detail template which also contains a grid. The detail grid is databound (Ajax) to another datasource than the parent grid. In the detail grid I have a client template column. Problem is that in the client template of the detail grid I can only access the fields from the parent grid, not the fields from the detail view grid. This used to work perfectly in the Telerik MVC extentions.
The parent grid
@(Html.Kendo().Grid(Model)
.Name("UserManagement")
.DataSource(dataBinding =>
{
dataBinding.Ajax().Read( read => read.Action("_UserManagement", "Account"))
.Create( create => create.Action( "CreateUser", "Account"))
.Model( model => model.Id( u => u.Id ));
})
.ToolBar(commands =>
{
commands.Create().HtmlAttributes(new { @class = "action pie" });
})
.Columns(column =>
{
column.Bound(c => c.Name).Title(ViewResources.UserManagement.Username.ToUpper());
column.Template(@<
text
></
text
>)
.ClientTemplate( "<
input
type
=
'button'
class
=
'action pie'
value='" + ViewResources.UserManagement.ResetPw +
"'
onclick
=
'onResetPassword( #= Id #, \"#= Name #\" )'
/> " +
"<
input
type
=
'button'
class
=
'action pie'
value='" + ViewResources.UserManagement.Delete +
"'
onclick
=
'onDeleteUser( #= Id #, \"#= Name #\" )'
/>")
.HtmlAttributes(new { style = "text-align: center;" })
.Width(400);
})
.Editable(editing => editing.Mode(Kendo.Mvc.UI.GridEditMode.InLine))
.Pageable()
.Sortable()
.Filterable()
.Events(e => e.DataBound("onDataBound"))
.ClientDetailTemplateId("userRoleLinkTemplate")
)
And the detail grid:
In the ClientTemplate of the detail grid I want to access the RoleId and UserId fields of the row but I get the "ReferenceError: RoleId is not defined" message. Scoping it using 'data.RoleId' also does not work because then 'data.RoleId' is replaced with 'undefined'.
Any ideas?