时间:2020-12-02 13:04:00 | 栏目:.NET代码 | 点击:次
如上图所示,如果查询供应商名称包括机械的公司,正常设置是不可以的,只能从头开始筛选:
方法1:
以下是以为网名为[不是小宽]的网友发给我的完美解决方案,我在此贴出来,大家可以共同学习:
/// <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;//设置为过滤是可以多选 } }
在要查询的窗体中调用即可:
SetFilter( gridView2 );
下面是效果图:
再次感谢热心的[不是小宽]!!!奋斗
方法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; //筛选条件设置为包含 } }