Is there any way that i can bind the check box in the grid. I have a hierarchical grid, in which I have a check box in child grid. When i try to put client template for the check box in the child grid, since the child grid is already a detail template and I am trying to put client template it is throwing error. Is there any way i can bind in some other way.
<
div
class
=
"container-fluid"
>
<
div
class
=
"row"
>
<
div
class
=
"col-xs-18 col-md-12"
>
@(Html.Kendo().Grid<
BHEBS.Areas.Admin.Models.ContractModel.providers
>()
.Name("grid")
.Columns(columns =>
{
columns.Bound(p => p.ContractorType).Title("Type").Width(70);
columns.Bound(p => p.ContractorName).Title("Contractor Name").Width(150);
columns.Bound(p => p.BHSISNum).Width(120);
columns.Bound(p => p.IsParent).Width(80).Title("Is Parent").ClientTemplate("<
input
type
=
'checkbox'
disabled
=
'disabled'
#= IsParent ?
checked
=
'checked'
: '' #
class
=
'chkbx'
/>").HtmlAttributes(new { style = "text-align: center" });
columns.Bound(p => p.ParentName).Title("Parent Name").Width(150);
//columns.Bound(p => p.ContractorIsAlsoRegion).Width(80).Title("Is Region").ClientTemplate("<
input
type
=
'checkbox'
disabled
=
'disabled'
#= ContractorIsAlsoRegion ?
checked
=
'checked'
: '' #
class
=
'chkbx'
/>").HtmlAttributes(new { style = "text-align: center" });
columns.Bound(p => p.StartDate).Format("{0:MM/dd/yyyy}").Width(100);
columns.Bound(p => p.EndDate).Format("{0:MM/dd/yyyy}").Width(100);
columns.Command(command => command.Custom("Remove").Text("Remove").SendDataKeys(true).Click("deleteClick").HtmlAttributes(new { @class = "k-button k-button-icontext k-grid-add k-primary" })).Width(100);
})
.Events(e => e.DataBound("onDataBound"))
.Pageable(pageable => pageable.Refresh(true).PageSizes(true).ButtonCount(5))
.Sortable()
.Scrollable()
.Filterable()
.Selectable()
.Resizable(resize => resize.Columns(true))
.ClientDetailTemplateId("template")
.HtmlAttributes(new { style = "height:450px;" })
.DataSource(dataSource => dataSource.Ajax().PageSize(10).Read(read => read.Action("Contractors_Read", "Contract").Data("additionalInfo")).Model(model => model.Id(p => p.Id))))
</
div
>
</
div
>
</
div
>
// My child grid
<
script
id
=
"template"
type
=
"text/kendo-tmpl"
>
@(Html.Kendo().Grid<
BHEBS.Areas.Admin.Models.ContractModel.serviceDetails
>()
.Name("grid_#=Id#")
.Columns(columns =>
{
columns.Bound(o => o.ServiceId).Hidden(true);
columns.Bound(p => p.ServiceName);
columns.Bound(o => o.ServiceType);
columns.Bound(o => o.AdultChild);
columns.Bound(o => o.Qualifier);
columns.Bound(o => o.ServiceModifier);
columns.Bound(o => o.WomenSetAside).Title("Women Set Aside"); // this is my check box
columns.Bound(o => o.StartDate).Format("{0:MM/dd/yyyy}");
columns.Bound(p => p.BudgetParent).Width(80).Title("Budget Parent"); // this is my check box
columns.Bound(p => p.ProcedureParent).Width(80).Title("Procedure Parent"); // this is my check box
//columns.Bound(o => o.EndDate).Format("{0:MM/dd/yyyy}");
columns.Command(command => command.Custom("Delete").Text("Remove").SendDataKeys(true).Click("deleteClickServices").HtmlAttributes(new { @class = "k-button k-button-icontext k-grid-add k-primary" }));
})
.Events(e => e.DataBound("onDataBoundServices"))
.ToolBar(toolbar =>
{
toolbar.Template(@<
text
>
<
div
class
=
"toolbar"
>
<
button
class
=
"k-button k-button-icontext k-grid-add k-primary"
id
=
"serviceskendowindow"
>Assign Services</
button
>
</
div
></
text
>);
})
.DataSource(dataSource => dataSource.Ajax().PageSize(10).Read(read => read.Action("Services_Read", "Contract", new { contractorId = "#=Id#", contractId = ViewBag.ContractService.Id })))
.Resizable(resize => resize.Columns(true))
.Pageable(pageable => pageable.Refresh(true).PageSizes(true).ButtonCount(5))
.Sortable()
.ToClientTemplate()
)
</
script
>