添加样式编辑器 [英] Adding style to Editor For

查看:142
本文介绍了添加样式编辑器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想一个样式应用到编辑器的元素,但我不能让它工作;我究竟做错了什么?

  @ Html.EditorFor(型号=> model.ClienteNuevo)
@ Html.ValidationMessageFor(型号=> model.ClienteNuevo,新字典<字符串,字符串> {{风格,宽度:500像素}})


解决方案

有没有办法添加HTML与 EditorFor 属性method.You应该创建一个自定义的<一个href=\"http://bradwilson.typepad.com/blog/2009/10/aspnet-mvc-2-templates-part-1-introduction.html\">editor模板或 EditorFor 的使用 Html.TextboxFor istead。您应该检查这些主题<一个href=\"http://stackoverflow.com/questions/3735400/html-attributes-for-editorfor-in-asp-net-mvc\">topic1, <一href=\"http://stackoverflow.com/questions/6550972/mvc-3-html-editorfor-add-html-attribute-not-work\">topic2.

I'm trying to apply a Style to the Editor for an element, but I can't make it work; what am I doing wrong?

@Html.EditorFor(model => model.ClienteNuevo)
@Html.ValidationMessageFor(model => model.ClienteNuevo,"" ,new Dictionary<string,     string> { { "style", "width:500px" } })

解决方案

There is no way to add html attributes with the EditorFor method.You should create a custom editor template or use Html.TextboxFor istead of EditorFor. You should check these topics topic1, topic2.

这篇关于添加样式编辑器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆