I have an asp.net mvc3 site that is showing some odd behavior when clicking the back button. I have a form with a text input, the value is set to a property on my Model, like this:
@using (Html.BeginForm("Search", "Home", FormMethod.Get, new { name = "searchForm" }))
{
<div>
<input id="term" type="text" name="Term" value='@Model.Term' />
<input type="submit" value="Search" />
</div>
}
Everything works great, except when using the back button in the browser. If I enter "ABC" then submit my form, enter "XYZ" and submit again, then go back I am still seeing "XYZ" in the text field, but when I inspect the html using the browser developer tools it's showing the correct value of "ABC" (correct value is also in the query string).
I also have another place on the page where I'm dislaying the same @Model.Term value, but in that place it's being displayed correctly as "ABC".
Any ideas? I feel like it has to be something stupid that I'm doing but I can't figure it out :)