17,740
社区成员
发帖
与我相关
我的任务
分享
var UserSource = IFactory.Instance<IUserBLL>().GetAll();
var DepSource = IFactory.Instance<IDepBLL>().GetAll();
//GridBand UseBand = new GridBand();
//UseBand.Caption = "工号";
//UseBand.RowCount = 2;
//bandedGridView1.Bands.Add(UseBand);
//GridBand DemBand = new GridBand();
//DemBand.Caption = "部门";
//DemBand.RowCount = 2;
//bandedGridView1.Bands.Add(DemBand);
typeof(Department).GetProperties().ToList().ForEach(x =>
{
if (x.Name == "Depname")
{
GridBand newband = new GridBand();
newband.Caption = "部门";
newband.RowCount = 2;
bandedGridView1.Bands.Add(newband);
BandedGridColumn bgc = new BandedGridColumn();
bgc.FieldName = x.Name;
bgc.UnboundType = DevExpress.Data.UnboundColumnType.Bound;
bgc.VisibleIndex = bandedGridView1.Columns.Count;
bgc.OwnerBand = newband;
}
});
typeof(User).GetProperties().ToList().ForEach(x =>
{
if (x.Name == "Number" || x.Name == "Name" )
{
GridBand newband = new GridBand();
if (x.Name == "Number")
{
newband.Caption = "工号";
}
else
{
newband.Caption = "姓名";
}
newband.RowCount = 2;
bandedGridView1.Bands.Add(newband);
BandedGridColumn bgc = new BandedGridColumn();
bgc.FieldName = x.Name;
bgc.UnboundType = DevExpress.Data.UnboundColumnType.Bound;
bgc.VisibleIndex = bandedGridView1.Columns.Count;
bgc.OwnerBand = newband;
}
});
gridControl1.DataSource = UserSource;
写条sql 语句不就出来啦。
你赢了,查的时候谁不会查,我们问题是动态添加列,还要计算