你能帮我么?因此,关于CSS没有定义类的问题,它是,但简单地说,它没有添加到输入字段.
这是视图中的代码:
@model eVinogradarstvo.Models.Detaljiviewmodel@{ VIEwBag.Title = "Edit";}@using (HTML.BeginForm("PromijeniPodatke","KorisnikDetalji",FormMethod.Post,new { enctype = "multipart/form-data",@ })){@HTML.AntiForgeryToken()<div > @HTML.ValIDationSummary(true) @HTML.HIDdenFor(model => model.kd.ID) @HTML.HIDdenFor(model => model.kd.korisnik_ID) @HTML.HIDdenFor(model => model.kd.slika) @HTML.HIDdenFor(model => model.kd.dokument_ID) <table > <tr> <td>Slika profila</td> <td><input type="file" name="uploadImages" /></td> </tr> <tr> <td>@HTML.displaynameFor(model => model.kd.ime)</td> <td> @HTML.EditorFor(model => model.kd.ime,new { HTMLAttributes = new { @class = "form-control" } }) @HTML.ValIDationMessageFor(model => model.kd.ime) </td> </tr> <tr> <td>@HTML.displaynameFor(model => model.kd.prezime)</td> <td> @HTML.EditorFor(model => model.kd.prezime,new { @class = "form-control" }) @HTML.ValIDationMessageFor(model => model.kd.prezime) </td> </tr> <tr> <td>@HTML.displaynameFor(model => model.kd.adresa)</td> <td> @HTML.EditorFor(model => model.kd.adresa,new { @class = "form-control" }) @HTML.ValIDationMessageFor(model => model.kd.adresa) </td> </tr> <tr> <td>@HTML.displaynameFor(model => model.kd.grad)</td> <td> @HTML.EditorFor(model => model.kd.grad) @HTML.ValIDationMessageFor(model => model.kd.grad) </td> </tr> <tr> <td>@HTML.displaynameFor(model => model.kd.drzava)</td> <td> @HTML.EditorFor(model => model.kd.drzava) @HTML.ValIDationMessageFor(model => model.kd.drzava) </td> </tr> <tr> <td>@HTML.displaynameFor(model => model.kd.datum_rodenja)</td> <td> @HTML.EditorFor(model => model.kd.datum_rodenja) @HTML.ValIDationMessageFor(model => model.kd.datum_rodenja) </td> </tr> <tr> <td>Mjerna jedinica težine</td> <td> @HTML.DropDownListFor(model => model.kd.mj_tezine,new SelectList(Model.DDLtezina,"vrijednost","opis")) @HTML.ValIDationMessageFor(model => model.kd.mj_tezine) </td> </tr> <tr> <td>Mjerna jedinica tekućine</td> <td> @HTML.DropDownListFor(model => model.kd.mj_tekucine,new SelectList(Model.DDLtekucina,"opis")) @HTML.ValIDationMessageFor(model => model.kd.mj_tekucine) </td> </tr> <tr> <td></td> <td><input type="submit" value="Spremi" /></td> </tr> </table></div>
}
有什么建议?
解决方法 ASP.NET中的EditorFor MVC 3不支持以这种方式将CSS传递给生成的HTML.您必须创建自定义编辑器模板并传递自定义viewData条目并手动执行(如上面显示的链接答案).这已在MVC 5.1中得到纠正,但如果您不愿意创建自己的模板,则无法使用EditorFor在MVC 3中实现此功能.
总结以上是内存溢出为你收集整理的HTML.EditorFor添加类不起作用全部内容,希望文章能够帮你解决HTML.EditorFor添加类不起作用所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)