I have a view, which consists of several textbox fields, used for searching/filtering and the Index method on the controller looks like this:
public ActionResult Index(string param1, string param2, string param3... string paramN)
This view receives a PagedList.IPagedList<FooViewModel>
.
Based on filter/search using multiple fields, it recommends to use a ViewModel to search/filter. Which makes sense as it will make the code simple, and manageable.
Refactor result would look like this:
Index(FooSearchViewModel)
ViewModel:
class FooSearchViewModel{
public List<string> Filters {get;set;}
public string SearchValue {get;set;}
}
I want to remove all the search fields and replace with a DropDownListFor html helper, that has a list of filter options(param1,param2,param3...paramN)
And only one textbox field, in which a searchvalue will be input.
So the question is, how can I bind the FooSearchViewModel to the DropDownList helper in Razor instead of Paged.IPageList<FooViewModel>