How to clear textboxes defined with MVC HTML helpers?

The HTMLHelper's first look at the ModelState and ViewData to see if any values match their key and then finally use whatever value you provide them If you need to reset the textboxe's value you also need to clear the ModelState entry with the matching key. Another alternative is redirecting to the same page instead of simply rendering a view via javascript or with MVC.

The HTMLHelper's first look at the ModelState and ViewData to see if any values match their key and then finally use whatever value you provide them. If you need to reset the textboxe's value you also need to clear the ModelState entry with the matching key. Another alternative is redirecting to the same page instead of simply rendering a view via javascript or with MVC.

You also need to clear the ModelState entry with the matching key. " -- How exactly do you do that? – Cynthia Aug 10 '10 at 0:26 OK, I think I figured out how to do that: ValueProviderResult abc = new ValueProviderResult("", "", System.Globalization.CultureInfo.

CurrentCulture); ModelState. SetModelValue("addName", abc); Is that how you would do it? – Cynthia Aug 10 '10 at 0:29 It does seem to blank out the field -- would this be the preferred way?

– Cynthia Aug 10 '10 at 0:30 @jfar, I think this is the only way besides creating your own html helper that ignores modelstate. – jfar Aug 10 '10 at 1:27 +1 RedirectToAction should do it, no doubt. I think it's the easiest way – Francisco Aug 10 '10 at 1:40.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions