LookUpEdit

序言

 

LookUpEdit

 滚动条

GridLookUpEdit

删除

 private void InitLookUp()
        {
            DataTable dt = new DataTable();
            dt.Columns.Add("ProductID", typeof(string));
            dt.Columns.Add("ProductName", typeof(string));
            for (int i = 0; i < 20; i++)
            {
                DataRow dr = dt.NewRow();
                dr["ProductID"] = i.ToString();
                dr["ProductName"] = $"{i}-描述";
                dt.Rows.Add(dr);
            }


            // Bind the edit value to the ProductID field of the "Order Details" table;

            // the edit value matches the value of the ValueMember field.

            //lookUpEditGroupType.DataBindings.Add("EditValue", dt, "ProductID");

            lookUpEditGroupType.Properties.NullText = string.Empty;

            // Prevent columns from being automatically created when a data source is assigned.

            lookUpEditGroupType.Properties.View.OptionsBehavior.AutoPopulateColumns = false;

            // The data source for the dropdown rows

            lookUpEditGroupType.Properties.DataSource = dt;

            // 下拉框显示的字段数据.

            lookUpEditGroupType.Properties.DisplayMember = "ProductName";

            // The field matching the edit value.

            lookUpEditGroupType.Properties.ValueMember = "ProductID";

            // Add two columns in the dropdown:

            // A column to display the values of the ProductID field;

            GridColumn col1 = lookUpEditGroupType.Properties.View.Columns.AddField("ProductID");
            col1.VisibleIndex = 0;
            col1.Caption = "代码";

            // A column to display the values of the ProductName field.

            GridColumn col2 = lookUpEditGroupType.Properties.View.Columns.AddField("ProductName");
            col2.VisibleIndex = 1;
            col2.Caption = "描述";

            // Set column widths according to their contents.

            lookUpEditGroupType.Properties.View.BestFitColumns();

            // Specify the total dropdown width.

            lookUpEditGroupType.Properties.PopupFormWidth = 300;

        }
View Code

SearchLookUpEdit

 

资料

GridLookUpEdit多列模糊查询最简单方式

GridControl 继承写法修改自己的GridControl

posted @ 2020-03-07 20:26  ~沐风  阅读(159)  评论(0编辑  收藏  举报