asp.net - Kendo DropDownListFor not s ending info to controller -


this baffling. in 1 of mvc models, project, have 2 properties both save ids other models, so.

public class project {     ...     public int platformid { get; set; }     public int departmentid { get; set; }     ... } 

i use custom editor in edit these fields kendo dropdown, using respective names , ids text , value fields.

<div class="col-md-11 details-item">     @html.labelfor(m => m.platformid, new { @class = "col-md-4 details-label" })     @(html.kendo().dropdownlistfor(m => m.platformid)         .name("platformid")         .datavaluefield("id")         .datatextfield("platformname")         .bindto((system.collections.ienumerable)viewdata["platforms"])         .htmlattributes(new { @class = "col-md-7 details-editor" })     ) </div> <div class="col-md-11 details-item">     @html.labelfor(m => m.departmentid, new { @class = "col-md-4 details-label" })     @(html.kendo().dropdownlistfor(m => m.departmentid)         .name("departmentid")         .datavaluefield("id")         .datatextfield("name")         .bindto((system.collections.ienumerable)viewdata["departments"])         .htmlattributes(new { @class = "col-md-7 details-editor" })     ) </div> 

what's crazy platformid saves perfectly, departmentid not sent controller. if departmentid thing change while editing, not register change has been made. otherwise, gets sent default 0.

the department class insanely simple.

public class department {     [key]     public int id { get; set; }     [displayname("department name")]     public string name { get; set; } } 

platformid identical. maybe i'm missing stupid, or maybe there evil afoot. can provide!

figured out answer - turns out having dropdown in editor template not work if item nullable! changed public int? departmentidto public int departmentidin project model, , life again.


Comments