c# - ForeignKey displays a textbox instead of dropdownlist -
here issue :
i have 2 project similar code display dropdownlist inside kendogrid. in first project works fine, in second project got textbox dipslaying instead of dropdown. i've searched around telerik nothing resolve issue. think missing in project make work fine. or blocking ! can't find .. hope me !
here grid :
@(html.kendo().grid<displayunitemultiple>() .name("griddisplayunitemultiple") .toolbar(t => t.create().text("ajouter un couple valeur/ unite")) .columns(columns => { columns.bound(c => c.id).hidden(true); columns.bound(c => c.valeur); columns.foreignkey(c => c.unite, unitesdeconversion, "value", "text").title("unité").width(200); }) .editable(editable => editable.mode(grideditmode.incell).enabled(true)) .events(e => e.edit("ongridchange")) .datasource(datasource => datasource .ajax() .update(builder => builder.url("")) .pagesize(50) .batch(false) .model(model => { model.id(unitemultiple => unitemultiple.id); model.field(unitemultiple => unitemultiple.valeur); model.field(unitemultiple => unitemultiple.unite); }) .serveroperation(true) ))
you might missing add editor template in project.
create new folder named editortemplates
in ../views/shared/
directory, if there not already. create new file named gridforeignkey.cshtml
in folder , copy below code it, save , try again.
@model object @( html.kendo().dropdownlistfor(m => m) .bindto((selectlist)viewdata[viewdata.templateinfo.getfullhtmlfieldname("") + "_data"]) )
Comments
Post a Comment