Using MVC 4 I create a text box for a model property with the "data-message" attribute:
@Html.TextBoxFor(o => o.TradeOrder.Symbol, new {data-message="Required"})
However, I get the following error:
Invalid anonymous type member declarator. Anonymous type members must be declared with a member assignment, simple name or member access.
Use _
:
@Html.TextBoxFor(o => o.TradeOrder.Symbol, new {data_message="Required"})
The TextBoxFor helper will know what to do and replace it with -
when generating the markup.
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