Reputation: 14668
Is there a method to filtering a ASP .NET MVC 3 Index view?
I am thinking a search grid where you enter some parameters that then filter the indexs datasource. In PHP world I would use $_GET or $_POST to retrieve the search parameter results.
Upvotes: 2
Views: 1848
Reputation: 5534
You can do the same in your index view. You just need to accept optional parameters in your controller.
public ActionResult Index(int? param1, string param2, int? param3){
//filter away
}
I usually setup a form on the view for the parameter entry, and then just change the METHOD
to GET
instead of POST
.
Upvotes: 3