c# GridControl fuzzy query implementation code example

黄舟
Release: 2017-03-22 11:25:20
Original
2873 people have browsed it

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;//设置为过滤是可以多选
      }
    }
Copy after login

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;  //筛选条件设置为包含 
      }
    }
Copy after login

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!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!