Back to previous view with data filled

1

I have 3 View's, a main (Index) containing fields to perform filters and a search button, another, GridIndex (rendered within the view Index), where records are demonstrated based on the search filters, and a third Information) that is displayed when the user clicks on an existing button in GridIndex.

When the user accesses the information view, and returns to the previous page, only the Index view is displayed, forcing the user to click the search button again to view the records.

Is there a way, when the user returns to the previous page, in addition to Index, to display the filled GridIndex?

    
asked by anonymous 06.05.2015 / 14:16

1 answer

2

Use GET instead of POST :

@using (Html.BeginForm("Acao", "Controller", FormMethod.Get))
{
    ...
}

Action that receives POST should allow GET also:

[AcceptVerbs(HttpVerbs.Get | HttpVerbs.Post)]
public ActionResult Index(ObjetoPesquisa objPesquisa) 
{
    ...
}

No GET your search data is preserved in the URL, unlike POST . To work in POST , it would be necessary to store everything in Session , which is not recommended.

    
06.05.2015 / 17:19