Creating a dropdownlist Search option

Sep 11, 2012 at 7:55 PM

Hi, i´ve been working with the helper to use instead of the textbox, a dropdownlist to search records in the grid. The idea is to populate the dropdownlist with only the values that exist in the grid, but I cant seem to be able to do it.


The idea I have in mind, is having the dropdowlist, in all of the desired columns (just like Supplier and Categories in the example file, in the ToolbarSearching.cshtml)


I have in my viewmodel:

[JqGridColumnSearchable(true, SearchType = JqGridColumnSearchTypes.Select)]      [JqGridColumnSortable(true)]

public string ColumnName{ get; set; }

I´d like that column to have a dropdownlist to filter the desired values, but instead I dont even see a dropdownlist, it´s just empty space.

Am I missing something? Thanks.

Sep 11, 2012 at 8:35 PM


You are missing the source for the select element items. This is how those attributes look in sample project:

[JqGridColumnSearchable(true, "Suppliers", "Home", SearchType = JqGridColumnSearchTypes.Select, SearchOperators = JqGridSearchOperators.Eq | JqGridSearchOperators.Ne)]
public string Supplier { get; set; }

The second and third parameter provides action and controller names which will be used to populate the select, you need something similiar.

Tomasz Pęczek