When I click on inline edit button, column titled "Industry" do not retain its value.
columns.Bound(c => c.IndustryName).Title("Industry").EditorTemplateName("AppPackIndEditor").Filterable(ftb => ftb.Extra(false).Operators(Operator => Operator.ForString(str => str.Clear().Contains("Contains")))).Width(120);
This is the code for the editor :
@using Kendo.Mvc.UI
@{
ViewBag.Title = "AppPackIndEditor";
}
@(Html.Kendo().DropDownListFor(m => m)
.Name("IndustryName")
.SelectedIndex(0)
.Filter(FilterType.StartsWith)
.DataTextField("IndustryName")
.DataValueField("IndustryId")
.HtmlAttributes(new { style = "text-align: center;", required = "required", validationmessage = "Select Industry" })
.BindTo((System.Collections.IEnumerable)ViewData["Industry"])
.Events(x => x.Change("onChangeDropDown").Change("IndustryChange"))
.OptionLabel("--- Select ---")
.NoDataTemplateId("noDataTemplate")
)
I have tried renaming the property name etc but the issue still persists
When using the
DropdownListFor(m=>m)there is no need to set theName()options. With the provided configuration the entire dataItem will be set as value for the IndustryName model property. Add theValuePrimitive(true)so the value of the dataItem's field as set in theDataValueFieldis set as value of theIndustryNameproperty. If theIndustryNameis a string you can update the editor the following way: