如何在LookUpEdit中实现多列过滤
1个回答
展开全部
ev控件的LookUpEdit控件的最大特点之一是下拉框的每一行可以是多列。但是该控件在绑定数据源之后,需要指定一列为ValueMember,表示下拉框中每一列的value,还需要指定一列为DisplayMember,表示选中一行后显示在控件的文本框中的值。正常情况下LookUpEdit默认只按displayValue的值进行自动匹配,要实现多列过滤代码如下:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
void gridLookUpEdit1_Popup(object sender, EventArgs e)
{
FilterLookup(sender);
}
private void FilterLookup(object sender) {
Text += " ! ";
GridLookUpEdit edit = sender as GridLookUpEdit;
GridView gridView = edit.Properties.View as GridView;
FieldInfo fi = gridView.GetType().GetField("extraFilter", BindingFlags.NonPublic | BindingFlags.Instance);
Text = edit.AutoSearchText;
BinaryOperator op1 = new BinaryOperator("Code", edit.AutoSearchText + "%", BinaryOperatorType.Like);
BinaryOperator op2 = new BinaryOperator("Name", edit.AutoSearchText + "%", BinaryOperatorType.Like);
1
2
3
4
5
6
7
8
9
10
11
12
13
14
void gridLookUpEdit1_Popup(object sender, EventArgs e)
{
FilterLookup(sender);
}
private void FilterLookup(object sender) {
Text += " ! ";
GridLookUpEdit edit = sender as GridLookUpEdit;
GridView gridView = edit.Properties.View as GridView;
FieldInfo fi = gridView.GetType().GetField("extraFilter", BindingFlags.NonPublic | BindingFlags.Instance);
Text = edit.AutoSearchText;
BinaryOperator op1 = new BinaryOperator("Code", edit.AutoSearchText + "%", BinaryOperatorType.Like);
BinaryOperator op2 = new BinaryOperator("Name", edit.AutoSearchText + "%", BinaryOperatorType.Like);
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询