i want to add default value to the html text box by the view data. t开发者_StackOverflow社区he foolwing code will give an idea wht i want to do exactly
, new { maxlength = 4 })%>but it shows an error. plz tel me the solution for this. thank in advance....
You want to do this instead:
Html.TextBox("quantity", Html.Encode(ViewData["quantity"]), new { maxlength = 4 })
Note: I removed the scriptlet tags around your Html.Encode. Once you're inside scriptlet tags, you don't need to use them again.
精彩评论