Basics

Searching (sometimes referred to as filtering) is the functionality to find matches of row data based on certain criteria. jqGrid for ASP.NET provides several modes for searching.

By default, filtering is done automatically. There is a property for each grid column called Searchable. The default is true. If set to false, the column will not appear in the search dialog and/or toolbar. Showing searching options is controlled by the ToolBarSettings.ShowSearchToolbar and ToolBarSetting.ShowSearchButton properties.

<trirand:JQGrid runat="server" ID="JQGrid1" DataSourceID="SqlDataSource1"> <Columns> <trirand:JQGridColumn DataField="OrderID" Searchable="false" /> <trirand:JQGridColumn DataField="RequiredDate" Searchable="true" /> </Columns> <ToolBarSettings ShowSearchToolBar="true" ShowSearchButton="true" /> </trirand:JQGrid>

Even when done automatically (the default), jqGrid fires the Searching / Searched events, where you can hook custom code and cancel the default logic. The most common case is when you want to hook the Searching event is to cancel the filtering in the case where end-users select "All" (meaning, we do not wish to filter the rows), e.g.

protected void JQGrid1_Searching(object sender, Trirand.Web.UI.WebControls.JQGridSearchEventArgs e) { if (e.SearchString == "All") e.Cancel = true; }


  Last Updated: 11/12/2009 | © Trirand, 2009