MVC index page and filter

This seems like a very simple question, but I'm lost and need a few pointers.

I am using ASP.NET MVC C # and have an index page that displays a list of items that works fine.

Now I'm trying to add a DropDownList, which, depending on what the user selects, will filter the list of elements. But I keep thinking how you will do it in ASP.NET Web with RunAt Server, which, as I know, is wrong.

Any pointers would be appreciated.

+6
asp.net-mvc
source share
3 answers

Place the selection box on the form and send the form back to the filter method in your controller. Or If you want to use ajax, use Ajax.ActionLink to update the table with filtered results

<% Ajax.ActionLink("Filter", "FilterMethod", null, new AjaxOptions { UpdateTargetId = "tableId" }, new { Title = "Filter results" }) %> <table id="tableId"> .... </table> 

Where "FilterMethod" is located in the yo0ur controller

+9
source share
+2
source share
+1
source share

All Articles