I am setting up a solution in umbraco using MVC seriously for the first time. I have managed to render a form using BeginUmbracoForm, and submit data, which works wonders.
My issue is, I want to implement a reset button, but since my data is in Session, I have to reset server side.
View:
@using (Html.BeginUmbracoForm<Site1.Controllers.SearchCriteriaSurfaceController>("Search"))
{
@*Form here*@
@Html.ActionLink("Reset criterias", "Reset", "SearchCriteriaSurface", new {}, null)
<input class="btn btn-primary" type="submit" value="Search now" />
}
Controller:
public class SearchCriteriaSurfaceController : SurfaceController
{
[HttpPost]
public ActionResult Search(SearchParams model)
{
SearchParams.Params = model;
ViewBag.HasSought = true;
return CurrentUmbracoPage();
}
[HttpPost]
public ActionResult Reset()
{
SearchParams.ResetParams();
return CurrentUmbracoPage();
}
}
On click, I then get redirected to /umbraco/Surface/SearchCriteriaSurface/Reset which is a resource that cannot be found.
Any idea how I go about reloading the page after hitting the reset button?
Thanks for your time.