DevExpress LookupEdit RowFilter
There are two method to do this.
- Change DataSource
DataTable oldDataTable = myLookUpEdit.Properties.DataSource as DataTable;
DataRow[] myDataRows = oldDatatable.Select(filter);
DataTable newDataTable = oldDataTable.Clone();
foreach (DataRow dr in myDataRows) newDataTable.ImportRow(dr); ;
myLookupEdit.Properties.DataSource = newDataTable;
- Use GridLookUpEdit
myGridLookUpEdit.Properties.View.CustomRowFilter += (s, e) =>
{
DevExpress.XtraGrid.Views.Grid.GridView myView =
s as DevExpress.XtraGrid.Views.Grid.GridView;
DataView myDataView = myView.DataSource as DataView;
if (myDataView[e.ListSourceRow][index] holds some condition)
{
e.Visible = false; //hidden some row
e.Handled = true;
}
};
Written by 小叮噹文青
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Ui
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#