MVC4怎么設置@Html.TextBoxFor這樣的輸入框的css樣式


在傳統webForm中,輸入框的這樣的:

 <input id="userName" name="userName" type="text" value="" />

而在mvc中,可以寫成這樣

@Html.TextBoxFor(m => m.userName)

以上兩句是一樣的,那么如何在mvc中的@Html.TextBoxFor(m => m.userName)輸入框添加css樣式呢?

@Html.TextBoxFor(m => m.userName,new {@class="main",@style="width:20px;"}) 

上面一句就等於 

<input class="main" id="userName" name="userName" style="width:20px;" type="text" value="" /> 

  


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM