c# - mvc 3 Html.EditorFor add html attribute not work -


i try add html attribute editorfor

 @html.editorfor(model => model.username, new { style = "width: 100px" }) 

but way get

<input id="username" class="text-box single-line" type="text" value="" name="username"> 

editorfor going overwrite attributes. see html attributes editorfor() in asp.net mvc workarounds.

if need change display of width, , you're not relying on editor templates easiest fix use textboxfor instead

 @html.textboxfor(model => model.username, new { style = "width: 100px" }) 

Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -