Add css class to Html.EditorFor in MVC 2

前端 未结 8 1610
醉梦人生
醉梦人生 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:19

    I was looking for a solution to apply a style to a specific box generated by the @HTML.EditorFor helper method.

    The question was regarding setting a CSS class for @HTML.EditorFor but for anyone who wants to edit the style for a single element.. you can, for example, try this:

    In my block, I added a style based on the ID generated by the helper: ..

    
    

    and then in my page (i'm doing this in a partial view):

    @Html.EditorFor(e => e.EnrollmentInfo.Format)
    

提交回复
热议问题