3

basically, im calling Html.TextAreaFor to display a form, which is great/not a problem...

people enter text in it, and it gets submitted, and if it is successful, i want to return an empty Html.TextAreaFor... but after it's submitted, in the action method i am clear to set the Comment that people are making in the TextArea to an empty string "", however, when it's loaded, it always has the text from the previous load.

i am loading everything in ajax by just updating a Div... and to make sure everything is normal, i have (as a text) a normal Html.TextArea where i specify the name and value. the Html.TextArea is right under the Html.TextAreaFor and acts exactly as it should, but the Html.TextAreaFor for some reason is not!

this is strange because i am reloading the entire DIV which the form is contained in, from a PartialView, at evey submission!!

im also making sure the div is loading with a typical system.datetime.now string returned with everything, and the mentioned Html.TextArea working as it should, it's driving me insane... am i missing something guys? are there any perculiar properties about ...For's that i should be aware of?

1 Answer 1

4

Try clearing the ModelState object, which is the HTML helpers read the value from.

Also see What am I misunderstanding about how Html.TextBoxFor works?.

Sign up to request clarification or add additional context in comments.

1 Comment

/:) A SO user from Australia talking in Turkish. Wasn't expecting that :) Rica ederim.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.