I've got a grid, which uses in-line editing on the sub-grid for the linked hierarchical data.
When just using a text box, the validation message display, and prevents entry of a blank value, but when I replace it with a drop-down list editor template, the validation fails to fire, causing an error message to be displayed (from the controller) when the record tries to save. This is strange, as when I do similar drop-down lists with pop-up edit forms, the validation works fine.
The grid:-
The editor template for the purchaser field (PurchaserEditor.cshtml):-
The object meta data:-
Thanks
When just using a text box, the validation message display, and prevents entry of a blank value, but when I replace it with a drop-down list editor template, the validation fails to fire, causing an error message to be displayed (from the controller) when the record tries to save. This is strange, as when I do similar drop-down lists with pop-up edit forms, the validation works fine.
The grid:-
@(Html.Kendo().Grid<CMS_2013.Models.ApportionmentScenario>().Name("Grid").Events(e=>e.Edit("onEdit")).Columns(columns=>{ columns.Bound(o => o.ID).Title("ID"); columns.Bound(o => o.FormattedDateTime).Title("Created"); columns.Bound(o => o.ScenarioName).Title("Name"); columns.Bound(o => o.CreatingUser).Title("User"); columns.Command(command => { command.Edit(); command.Destroy(); }); }) .ClientDetailTemplateId("detailsTemplate") .ToolBar(commands=>commands.Create()) .Editable(editable=>editable .Mode(GridEditMode.PopUp)) .DataSource(dataSource=>dataSource .Ajax() .Model(m=>m.Id(p=>p.ID)) .Events(events => events.Error("error")) .PageSize(10) .Read(read=>read.Action("ReadScenarios","Apportionment")) .Create(create=>create.Action("InsertScenario","Apportionment")) .Update(update=>update.Action("UpdateScenario","Apportionment")) .Destroy(delete=>delete.Action("DeleteScenario","Apportionment")) ) .Pageable() .Sortable() .Filterable() ) </div><script id="detailsTemplate" type="text/kendo-tmpl"> @(Html.Kendo().Grid<CMS_2013.Models.ApportionmentData>() .Name("Data_#=ID#") .Columns(columns=> { columns.Bound(o => o.FormattedDateTime).Title("Date"); columns.Bound(o => o.Purchaser).Title("Purchaser"); columns.Bound(o => o.Apportionment); columns.Command(command => { command.Edit(); command.Destroy(); }); }) .ToolBar(commands=>commands.Create()) .Editable(editable=>editable .Mode(GridEditMode.InLine)) .DataSource(dataSource=>dataSource .Ajax() .Model(m=>m.Id(p=>p.ID)) .Events(events => events.Error("error")) .PageSize(10) .Read(read=>read.Action("ReadData","Apportionment", new { SID = "#= ID #" })) .Create(create=>create.Action("InsertData","Apportionment", new { SID = "#= ID #" })) .Update(update=>update.Action("UpdateData","Apportionment")) .Destroy(delete=>delete.Action("DeleteData","Apportionment")) ) .Pageable() .Sortable() .ToClientTemplate())@(Html.Kendo().DropDownList() .Name("Purchaser") .DataTextField("ShortName") .DataValueField("Purchaser") .OptionLabel("Choose Purchaser") .HtmlAttributes(new { style="width:180px;"}) .DataSource(source=>source .Read(read=>read.Action("GetPurchaserLookUpList2","ManualData"))))public class ApportionmentDataMD { [Required, StringLength(6)] [UIHint("PurchaserEditor")] public object Purchaser { get; set; } [Required] [UIHint("ApportionmentPercent")] public object Apportionment { get; set; } }