This article mainly introduces the fuzzy query implementation code of c# GridControl. Friends who need it can refer to it
As shown in the picture above, if Querying companies whose supplier names include machinery is not possible with normal settings. You can only filter from the beginning:
Method 1:
The following is the perfect solution sent to me by a netizen whose screen name is [not Xiaokuan]. I post it here so that everyone can learn together:
/// <summary> /// 设置girid为每一列都模糊搜索 /// </summary> /// <param name="gdv"></param> public static void SetFilter( DevExpress.XtraGrid.Views.Grid.GridView gdv ) { gdv.OptionsView.ShowAutoFilterRow = true; //gdv.OptionsFilter.AllowMultiSelectInCheckedFilterPopup = true; foreach (DevExpress.XtraGrid.Columns.GridColumn item in gdv.Columns) { item.OptionsFilter.AutoFilterCondition = DevExpress.XtraGrid.Columns.AutoFilterCondition.Contains; //筛选条件设置为包含 item.OptionsFilter.FilterPopupMode = FilterPopupMode.CheckedList;//设置为过滤是可以多选 } }
Inquire now Just call it in the form:
SetFilter( gridView2 );
The following is the rendering:
Thank you again for the enthusiastic [not Xiaokuan]!!!Struggle
Method 2:
private void gridView1_CustomDrawRowIndicator( object sender, DevExpress.XtraGrid.Views.Grid.RowIndicatorCustomDrawEventArgs e ) { foreach (DevExpress.XtraGrid.Columns.GridColumn item in gridView1.Columns) { item.OptionsFilter.AutoFilterCondition = DevExpress.XtraGrid.Columns.AutoFilterCondition.Contains; //筛选条件设置为包含 } }
The above is the detailed content of c# GridControl fuzzy query implementation code example. For more information, please follow other related articles on the PHP Chinese website!