(empty) choice in filter bar for GDBG

The GGC filter bar has an (empty) option for filtering empty strings and I would like to add that to the GDBG filter bar options. Is that an option?
Thanks

1 Reply

AD Administrator Syncfusion Team October 30, 2006 05:16 AM UTC

Hi Prumery,

This can be achieved by deriving the GridFilterBar class and override GridFilterBarRow and CreateUnquieEnteries methods is handled to add the "[Empty]"option in a FilterBar. Please try it and let us know if you need any further assistance.

public class MyGridFilterBar : GridFilterBar
{ private GridDataBoundGrid grid1;
public override void WireGrid(GridDataBoundGrid grid, GridStyleInfo style)
{ this.grid1 = grid;
base.WireGrid (grid, style);
}
protected override string GetFilterFromRow(GridDataBoundGrid grid)
{ GridCurrentCell cc = grid.CurrentCell;
string s = cc.Renderer.ControlText;
string rowFilter = base.GetFilterFromRow(grid);
if(s != "[Empty]")
return rowFilter;
else
return rowFilter.Replace("[Empty]","") ;
}
protected override DataTable CreateUniqueEntries(DataView dv, string colName)
{ DataTable dtt = base.CreateUniqueEntries(dv,colName);
DataRow dr= dtt.NewRow();
dr[0]="[Empty]";
dtt.Rows.InsertAt(dr,2);
return dtt;
}
}

The following sample demonstrates above technique.
http://www.syncfusion.com/Support/user/uploads/GDBG_FilterBar_ab82f2e4.zip

Best regards,
Haneef

Loader.
Up arrow icon