tags:

views:

37

answers:

1

i want to add default value to the html text box by the view data. the foolwing code will give an idea wht i want to do exactly

<%= Html.TextBox("quantity", <%= Html.Encode(ViewData["quantity"]) %>, new { maxlength = 4 })%>

but it shows an error. plz tel me the solution for this. thank in advance....

+1  A: 

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.

CubanX