Hello, I am having an issue where I have not been able to associate a selected item from a DropDownList to the submitted values of an editor template from my ListView.
Partial view that renders the ListView:
Editor Template for CorrectiveActionItemModel:
Editor template for CorrectiveActionItemType:
Now, when the CorrectiveActionItemModel is submitted I do not get any item in the POST for CorrectiveActionItemType. I suspect that there is some binding or setup that needs to occur in order to get the DropDownList's value to be associated to the model of CorrectiveActionItemModel.
I have tried following the pattern at Editor template documentation, but I could not get the .BindTo((IEnumerable)ViewData["CorrectiveActionType"])) even though I added it the controller that renders the ListView.
Any thoughts or ideas would be appreciated, thanks.
Partial view that renders the ListView:
@(Html.Kendo().ListView<
CorrectiveActionItemModel
>()
.Name("corrective-action-items-listview")
.TagName("div")
.ClientTemplateId("corrective-action-item-view-template")
.DataSource(dataSource => dataSource
.Model(model =>
{
model.Id("CorrectiveActionItemID");
model.Field(f => f.CorrectiveActionPlanID).DefaultValue(this.Model.CorrectiveActionPlanID);
model.Field(f => f.CorrectiveActionItemType);
})
.PageSize(1)
.Create(create => create.Action("Item_Create", "CorrectiveActionItem", new { this.Model.CorrectiveActionPlanID }))
.Read(read => read.Action("Items_Read", "CorrectiveActionItem", new { this.Model.CorrectiveActionPlanID }))
.Update(update => update.Action("Item_Update", "CorrectiveActionItem"))
.Destroy(destroy => destroy.Action("Item_Destroy", "CorrectiveActionItem"))
)
.Pageable()
.Editable())
@using Steton.Web.MVC.Model
@model CorrectiveActionItemModel
<
div
class
=
"corrective-action-item-display"
>
<
div
class
=
"edit-buttons"
>
<
a
class
=
"k-button k-button-icontext k-update-button"
href
=
"\\#"
><
span
class
=
"k-icon k-update"
></
span
></
a
>
<
a
class
=
"k-button k-button-icontext k-cancel-button"
href
=
"\\#"
><
span
class
=
"k-icon k-cancel"
></
span
></
a
>
</
div
>
@Html.HiddenFor(m => m.CorrectiveActionItemID)
@Html.HiddenFor(m => m.CorrectiveActionPlanID)
<
div
class
=
"action-section"
>
@Html.LabelFor(m => m.DirectiveText)
@Html.TextAreaFor(m => m.DirectiveText)
</
div
>
<
div
class
=
"action-section"
>
@Html.LabelFor(m => m.ActionTakenText)
@Html.TextAreaFor(m => m.ActionTakenText)
</
div
>
<
div
class
=
"action-section"
>
<
div
style
=
"clear:both"
>
<
div
class
=
"action-sub-edit-section"
>
<
div
>
@Html.LabelFor(m => m.DueDate)
@(Html.Kendo().DatePicker()
.Name("DueDate")
.Value("12/31/2013"))
</
div
>
<
div
>
@Html.LabelFor(m => m.IsCompleted)
@Html.CheckBoxFor(m => m.IsCompleted)
</
div
>
</
div
>
<
div
class
=
"action-sub-edit-section"
>
<
div
>
@Html.LabelFor(m => m.CorrectiveActionItemType)
@Html.EditorFor(m => m.CorrectiveActionItemType)
</
div
>
</
div
>
</
div
>
</
div
>
</
div
>
@using System.Collections
@(Html.Kendo().DropDownList()
.Name("CorrectiveActionItemType")
.DataTextField("TypeName")
.DataValueField("CorrectiveActionItemTypeID")
.DataSource(read => read.Read("Types","CorrectiveActionItem", new { correctiveActionPlanID = "#=CorrectiveActionPlanID#" })))
I have tried following the pattern at Editor template documentation, but I could not get the .BindTo((IEnumerable)ViewData["CorrectiveActionType"])) even though I added it the controller that renders the ListView.
Any thoughts or ideas would be appreciated, thanks.