How to set the width of the text box when using Html.TextBoxFor

后端 未结 6 1320
走了就别回头了
走了就别回头了 2021-02-01 02:20

I have the following line in my view:

<%= Html.TextBoxFor(m => m.Description)%>
6条回答
  •  忘了有多久
    2021-02-01 02:49

    A reusable solution is to set the width in your css file

    .wide
    {
         width: 300px;
    }
    

    then set it using the markup above

    <%= Html.TextBoxFor(m => m.Description, new { @class= "wide" })%> 
    

提交回复
热议问题