Add css class to Html.EditorFor in MVC 2

前端 未结 8 1619
醉梦人生
醉梦人生 2020-12-05 09:57

I\'m trying to add a css class to a textbox. This is what I have in my view:

<%: Html.EditorFor(m => m.StartDate) %>

I tried follo

8条回答
  •  生来不讨喜
    2020-12-05 10:10

    There is no overload for EditorFor that allows you to set HtmlProperties. (IDictionary htmlAttributes)

    This link explains how to do it:

    http://aspadvice.com/blogs/kiran/archive/2009/11/29/Adding-html-attributes-support-for-Templates-2D00-ASP.Net-MVC-2.0-Beta_2D00_1.aspx

提交回复
热议问题