I'm creating an Html TextBox via HtmlHelper and I can't get the value attribute set. I've tried both of the lines below and I have also googled but cannot find a solution:
<%= Html.TextBox("name", null, new { @class = "textbox", value = "hi" }) %>
<%= Html.TextBox("name", null, new { @class = "textbox", @value = "hi" }) %>
Both lines return an input element with value=""
What am I missing?
The value is the second parameter of the Html.TextBox method :
<%= Html.TextBox("name", "hi", new { @class = "textbox" }) %>
should work
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With