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?

Çağdaş Tekin
  • 16,592
  • 4
  • 49
  • 58
Erx_VB.NExT.Coder
  • 4,838
  • 10
  • 56
  • 92

1 Answers1

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?.

Community
  • 1
  • 1
Çağdaş Tekin
  • 16,592
  • 4
  • 49
  • 58