一.在UltraGrid中InitializeRow事件中添加
二.创建UltraDropDown,绑定在UltraGrid对应的列上面
UltraDropDown UltraDropDown1 = new UltraDropDown();
UltraDropDown1.ValueMember = "MOVEENTRANCE2";
UltraDropDown1.DisplayMember = "MOVEENTRANCE2";
List<YARD_MOVEINList> dataSource = new List<YARD_MOVEINList>();
Collection<YARD_MOVEIN> mpList = new Collection<YARD_MOVEIN>();
YARD_MOVEIN objPara = new YARD_MOVEIN();
objPara.SITENAME = ConnectionInfo.SiteName;
mpList = mesCommonService.GetQueryList(objPara, "GetMoveInList", "00001");
dataSource.Add(new YARD_MOVEINList { MOVEENTRANCE2 = "" });
for (int i=0;i<mpList.Count;i++)
{
dataSource.Add(new YARD_MOVEINList { MOVEENTRANCE2 = mpList[i].MOVEIN });
}
UltraDropDown1.DataSource = dataSource;
this.grdStockIn.DisplayLayout.Bands[0].Columns["MOVEENTRANCE2"].ValueList = UltraDropDown1;
这个其实挺简单的,创建UltraDropDown,中间那一部分是我将数据库中查询的部分加入下拉框,最后就是与UltraGrid中MOVEENTRANCE2列绑定,挂在上面。