I use that:
@(Html.Kendo().Grid<Lorem.Core.DataModels.Contacts.DMConEmail>()
.Name("ContactEmails")
.Columns(columns =>
{
columns.ForeignKey(p => p.Type, Html.GetEnumList(typeof(Lorem.Core.DataModels.Contacts.DMConEmailType)));
columns.Bound(p => p.Email);
columns.Command(command => { command.Edit(); command.Destroy(); });
})
.ToolBar(toolbar => toolbar.Create())
.Editable(editable => editable.Mode(GridEditMode.InLine))
.DataSource(datasource => datasource.Ajax()
.Model(model => model.Id(p => p.IdEmail))
.Create(update => update.Action("EmailInsert", "Contact", new { idContact = Model.IdContact }))
.Read(read => read.Action("EmailGetList", "Contact", new { idContact = Model.IdContact }))
.Update(update => update.Action("EmailUpdate", "Contact"))
.Destroy(update => update.Action("EmailDelete", "Contact"))
))
And I have a column that use an Enum to choose the email type. When I use that in a view, all is working fine. When I use it in an EditorTemplates I have this exception:
Ligne 1 : @model object
Ligne 2 :
Ligne 3 : @(
Ligne 4 : Html.Kendo().DropDownListFor(m => m)
Ligne 5 : .BindTo((SelectList)ViewData[ViewData.TemplateInfo.GetFullHtmlFieldName("") + "_Data"])
[ArgumentNullException: La valeur ne peut pas être null.
Nom du paramètre : source]
System.Linq.Enumerable.Select(IEnumerable`1 source, Func`2 selector) +4090943
Kendo.Mvc.UI.Fluent.DropDownListBuilder.BindTo(IEnumerable`1 dataSource) +88
ASP._Page_Views_Shared_EditorTemplates_GridForeignKey_cshtml.Execute() in c:\DCM\SVNPortailDCM\trunk\Softwares\Lorem\MVC\Views\Shared\EditorTemplates\GridForeignKey.cshtml:3
System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +198
System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +104
System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +90
System.Web.Mvc.RazorView.RenderView(ViewContext viewContext, TextWriter writer, Object instance) +235
@(Html.Kendo().Grid<Lorem.Core.DataModels.Contacts.DMConEmail>()
.Name("ContactEmails")
.Columns(columns =>
{
columns.ForeignKey(p => p.Type, Html.GetEnumList(typeof(Lorem.Core.DataModels.Contacts.DMConEmailType)));
columns.Bound(p => p.Email);
columns.Command(command => { command.Edit(); command.Destroy(); });
})
.ToolBar(toolbar => toolbar.Create())
.Editable(editable => editable.Mode(GridEditMode.InLine))
.DataSource(datasource => datasource.Ajax()
.Model(model => model.Id(p => p.IdEmail))
.Create(update => update.Action("EmailInsert", "Contact", new { idContact = Model.IdContact }))
.Read(read => read.Action("EmailGetList", "Contact", new { idContact = Model.IdContact }))
.Update(update => update.Action("EmailUpdate", "Contact"))
.Destroy(update => update.Action("EmailDelete", "Contact"))
))
And I have a column that use an Enum to choose the email type. When I use that in a view, all is working fine. When I use it in an EditorTemplates I have this exception:
Ligne 1 : @model object
Ligne 2 :
Ligne 3 : @(
Ligne 4 : Html.Kendo().DropDownListFor(m => m)
Ligne 5 : .BindTo((SelectList)ViewData[ViewData.TemplateInfo.GetFullHtmlFieldName("") + "_Data"])
[ArgumentNullException: La valeur ne peut pas être null.
Nom du paramètre : source]
System.Linq.Enumerable.Select(IEnumerable`1 source, Func`2 selector) +4090943
Kendo.Mvc.UI.Fluent.DropDownListBuilder.BindTo(IEnumerable`1 dataSource) +88
ASP._Page_Views_Shared_EditorTemplates_GridForeignKey_cshtml.Execute() in c:\DCM\SVNPortailDCM\trunk\Softwares\Lorem\MVC\Views\Shared\EditorTemplates\GridForeignKey.cshtml:3
System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +198
System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +104
System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +90
System.Web.Mvc.RazorView.RenderView(ViewContext viewContext, TextWriter writer, Object instance) +235