开发者

Filtering a Index view within ASP .NET MVC 3?

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 wou开发者_开发技巧ld use $_GET or $_POST to retrieve the search parameter results.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜