Hello,
I have a kendo grid with the FundAge column with a dropdown list editor template. When I select the value from the dropdown and click update the value is showing as undefined. Can someone help with this?
///Editor template
@model Models.FedAge
@(Html.Kendo().DropDownListFor(x => x)
.DataValueField("FedId")
.DataTextField("FedDesc")
.BindTo((System.Collections.IEnumerable)ViewData["FedAge"]))
//////// Grid column
@(Html.Kendo().Grid<AgencyInformation>()
.Name("AgencyInformationGrid")
.Columns(columns =>
{
columns.Bound(p => p.FundAge).ClientTemplate("#=FundAge.FedDesc#").Sortable(false).Width(175).HtmlAttributes(new { @class = "FundAgeClass" });
})
.ToolBar(toolbar => toolbar.Create())
.Editable(editable => editable.Mode(GridEditMode.InLine))
.Pageable()
.Sortable()
.Scrollable()
.HtmlAttributes(new { style = "height:500px;" })
.DataSource(dataSource => dataSource
.Ajax()
.AutoSync(false)
.Batch(false)
.PageSize(20)
.ServerOperation(false)
.Events(events => events.Error("errorHandler"))
.Events(events => events.RequestEnd("onAgeInfoRequestEnd"))
.Model(model => {
model.Id(p => p.AgeInfoId);
model.Field(p => p.AgeInfoId).Editable(false);
model.Field(p => p.FedAge.FedAgeDesc).Editable(false).DefaultValue(ViewData["FedAge"]);
})
.Create(update => update.Action("AddAgeInfo", "Cove").Type(HttpVerbs.Post))
.Read(read => read.Action("GetAgeInfo", "Cove").Type(HttpVerbs.Get))
.Update(update => update.Action("EditAgeInfo", "Cove").Type(HttpVerbs.Post))
.Destroy(update => update.Action("DeleteAgeInfo", "Cove").Type(HttpVerbs.Post))
)
//////Entity
public class AgeInfo
{
public string AgenfoId { get; set; }
[UIHint("FedlAgeEditor")]
[Required(ErrorMessage = "Required")]
public string FundAge{ get; set; }
public FedAge FedAge{ get; set; }
}
public class FedAge
{
public int FedAgeId { get; set; }
public string FedAgeDesc { get; set; }
}
}
///controller
[HttpGet]
public IActionResult AgeInfo()
{
//if (coveDetails!= null && coveDetails.AgeInfo!= null)
//{
// return View("AgeInfo", coveDetails.AgeInfo);
//}
ViewData["FedAge"] = lookupsDetails.FedAge;
ViewBag.FedAge= lookupsDetails.FedAge;
return View();
}
Can some one please help??