Html.TextBoxFor format and css class
I know I’m way late here but I just found a solution to this issue: <%: Html.TextBoxFor(model => model.StartDate, new { @class = “datepicker”, Value=String.Format(“{0:d}”, Model.StartDate) })%>
I know I’m way late here but I just found a solution to this issue: <%: Html.TextBoxFor(model => model.StartDate, new { @class = “datepicker”, Value=String.Format(“{0:d}”, Model.StartDate) })%>
You can set ID of a textbox like this. @Html.TextBoxFor(item => item.OperationNo, new { id = “MyId” }) OR @Html.TextBoxFor(item => item.OperationNo, htmlAttributes: new { id = “MyId” }) Output: <input … id=”MyId” name=”OperationNo” type=”text” />