views:

93

answers:

4

I have an ASP MVC form which updates a business object and then its action goes to another page.

Both of these pages have a textarea with an id "Description", when it goes to the other page, for reasons unknown it fills in the values which were entered before the form submission.

+2  A: 

Which method are you using to update your object? Have you tried adding the object type name in the ID?

Like, Product.Description instead of just Description.

Chad Moran
A: 
<p><label>Description</label><br /><br /><%=Html.TextArea("Description", new { style = "width:470px;" })%></p>

For clarification, I'm going from an "Edit project" page, to a "Add issue" page

qui
Try not to respond as answers, rather edit your post or make a comment.
Chad Moran
+1  A: 

Not knowing what your doing exactly, I'd say there is a 'Description' property on the ViewData's Model. ASP.NET MVC will try to match up your form values with values from the ViewData, including the Model. You can rename the control or reference the object directly as Chad said. eg Product.Description

With more details, someone may be able to help more.

Jab
A: 

Without seeing your controller actions this is a bit of guess work but how does it go to another page?

If in the post controller you return a different view (or return another action that returns a view etc) it may be that the ModelState is using the attempted values from the previous form submission, this is the expected behaviour (it's how the validation system and model binding works for a start). If you are sending them to a different form use a RedirectResult to your next action and use TempData if needed for any state you need to keep while transitioning.

If at all possible I'd also recommend using the strongly typed helpers such as Html.TextAreaFor(x=>x.Description)

Chao