当前位置:编程学习 > C#/ASP.NET >>

Dev控件库中Grid控件中下拉框级联显示

这个grid控件可以绑定多个下拉列表来进行级联显示吗?
ColumnEdit属性只是针对一列的,
能够做到只设置指定的单元格中的combobox的数据源吗? devexpress gridcontrol combobox --------------------编程问答-------------------- 自己找到方法了。主要是在这个事件中实现的CustomRowCellEditForEditing

DevExpress.XtraGrid.Views.Grid.GridView view = sender as DevExpress.XtraGrid.Views.Grid.GridView;

            RepositoryItemComboBox cbx = new DevExpress.XtraEditors.Repository.RepositoryItemComboBox();

            switch (e.Column.FieldName)
            {
                case "DBConstructionName":
                    cbx.Items.Clear();
                    cbx.Items.AddRange(constructions.Select(c => new Models.ComboBoxItemTextValue<int>(c.ConstructionID, c.ConstructionName)).ToList());
                    cbx.SelectedValueChanged += new EventHandler(cbx_SelectedValueChanged);
                    e.RepositoryItem = cbx;
                    break;
                case "DBBuildingName":
                    buildingBll = new BLL.Building(Login.UserId, Login.Password);
                    string constructid = view.GetRowCellDisplayText(e.RowHandle, "DBConstructionID");
                    //楼栋
                    buildingIListByDataBase = buildingBll.GetBuilding(iCityID, Convert.ToInt32(constructid), 0);
                    cbx.Items.Clear();
                    cbx.Items.AddRange(buildingIListByDataBase.Select(b => new Models.ComboBoxItemTextValue<int>(b.BuildingID, b.BuildName)).ToList());
                    cbx.SelectedValueChanged += new EventHandler(cbx_SelectedValueChanged);
                    e.RepositoryItem = cbx;
                    break;
                case "DBHouseName":
                    houseBll = new BLL.House(Login.UserId, Login.Password);
                    string bid = gvwFetchData.GetRowCellValue(e.RowHandle, "DBBuildingID").ToString();
                    //房号
                    house = houseBll.GetHouseList(Convert.ToInt32(bid), 0, iCityID);
                    cbx.Items.Clear();
                    cbx.Items.AddRange(house.Select(h => new Models.ComboBoxItemTextValue<int>(h.HouseID, h.HouseName)).ToList());
                    cbx.SelectedValueChanged += new EventHandler(cbx_SelectedValueChanged);
                    e.RepositoryItem = cbx;
                    break;
                default: break;
            }
            cbx.ParseEditValue += new ConvertEditValueEventHandler(cbx_ParseEditValue);

--------------------编程问答-------------------- 您好:我刚刚接触DEVExpress,combobox的级联显示已经搞了2天了,还是很模糊,你的这段程序我仔细看过了,可是还是搞不太清楚整个流程,可以告诉我你程序中的字段是来自同一张表还是不同的表吗?十分感激
补充:.NET技术 ,  C#
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,