This is a migrated thread and some comments may be shown as answers.

Pass Model to column ClientTemplate editor in Kendo Grid

1 Answer 164 Views
Grid
This is a migrated thread and some comments may be shown as answers.
GCS
Top achievements
Rank 1
GCS asked on 03 Jul 2014, 02:30 AM
I have a Kendo grid whereas the columns are defined as:
.Columns(columns =>
{
    columns.Bound(b => b.Field);
    columns.Bound(b => b.OldValue);
    columns.Bound(b => b.NewValue);
    columns.Bound(b => b.DateImported).Format("{0:dd-MMM-yyyy}");
    columns.Bound(b => b.BuildingChangeValidationStatusType).ClientTemplate("#=BuildingChangeValidationStatusType.Value#").Width(250);
    columns.Command(command => command.Custom("Update").Click("updateValidation"));
    columns.Command(command => { command.Edit(); }).Width(172);
})

The BuildingChangeValidationStatusType client template is defined as:
@model Rep.Models.BuildingChangeValidationViewModel
@(Html.Kendo().DropDownList()
    .Name("BuildingChangeValidationStatusType") // Name of the widget should be the same as the name of the property
    .DataValueField("Id")
    .DataTextField("Value")
    .BindTo((System.Collections.IEnumerable)Model.BuildingChangeValidationStatuses)
)

I'm wondering how I might pass the model for the Grid to the client template so that the line:

.BindTo((System.Collections.IEnumerable)Model.BuildingChangeValidationStatuses)
)

would resolve properly. Any ideas?

1 Answer, 1 is accepted

Sort by
0
Accepted
Vladimir Iliev
Telerik team
answered on 07 Jul 2014, 07:17 AM
Hi,

I already answered to this query in duplicated forum post created by you - #835817. Please keep in mind that it is highly recommended that you keep related questions in one support thread or a forum post, so that we can easily keep track of your support history and provide better answers in a shorter time.

Regards,
Vladimir Iliev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Grid
Asked by
GCS
Top achievements
Rank 1
Answers by
Vladimir Iliev
Telerik team
Share this question
or