In the above line...">

.net mvc 1.0 Html.TextBox

I have some code that only works for the first page. <% = Html.TextBox ("Amount", Model.Amount)%>

In the above line, the debugger shows the property calls to get Model.Amount every time the view is created. But the updated sum value is not reflected in the generated HTML.

reference

0


a source to share


2 answers


I'm assuming your form is being sent back to change the amount?



It looks like the action you are posting is not doing any work. You will need to post this source code.

0


a source


I think the problem you are having is probably that the value posted on the form is stored in ModelState and this overrides anything directly set as the value for the TextBox in your action method. This is the "function" of the HtmlHelper TextBox extension method. You can either not use the built-in HtmlHelper method, but manually inject an element of type = "text" html type into your form, or you can try calling ModelState.Clear () in your action somewhere.



0


a source







All Articles