Is there a way to format the value of a TextBox
using the following structure:
<td>@Html.TextBoxFor(m =>(m.Code), new { @required = "required"})</td>
Initially, this format works as intended. However, when a default value is set for the TextBox
:
<td>@Html.TextBoxFor(m =>(m.Code), new { @Value = @Model.Code, @required = "required"})</td>
An issue arises where an empty value is accepted despite the generation of the following Html code:
<td><input id="Code" name="Code" required="required" type="text" value="fff "></td>
- What could be causing this problem?
- Are there any solutions to address this issue?