Retain the html input value after post back?

lucky9

New Member
My Asp.Net MVC 4 has the following code in the Index View.\[code\]<form action="/Deal" method="GET"> <p> @Html.ActionLink("Create New", "Create") <input type="text" name="search"/> <input type="submit" value="http://stackoverflow.com/questions/15457640/Search" /> </p></form>\[/code\]And the following code in the DealController. However, the html search input is emtpy after post back. What's the best way to display the typed search string in the input box so users can continue modify it?\[code\]public ActionResult Index(string search){ var deals = Deals.Include(d => d.Address); if (search != null) deals = deals.Where(d => d.Address.ApartmentNum.Contains(search) || d.Address.StreetAddress.Contains(search) || d.Address.City.Contains(search) || d.Address.State == search || d.Address.Zip == search); return View(deals.ToList());}\[/code\]
 
Back
Top