C# 对于GridControl 动态加载动态生成的GridView
2017-05-25 16:40
417 查看
对于GridView来说,在实际应用中经常可能会需要动态生成列,
今天试着写了一下,大家看看即可,第一次写博客。。。。
>
private void NewGridView(List list) //
{
var gdv = new DevExpress.XtraGrid.Views.Grid.GridView();//
gdv.OptionsView.ShowGroupPanel = false;
}
public class Apple
{
private int size;
public int Size
{
get;set;
}
private int brand;
public int Brand
{
get;set;
}
}
今天试着写了一下,大家看看即可,第一次写博客。。。。
>
private void NewGridView(List list) //
{
var gdv = new DevExpress.XtraGrid.Views.Grid.GridView();//
gdv.OptionsView.ShowGroupPanel = false;
string[] temp = new Apple().GetNames(); //根据传入的数据类Apple的属性来动态生成GridView的列 for(int i = 0;i<= temp.Length;i++) { var col = new DevExpress.XtraGrid.Columns.GridColumn(); col .Caption = ass[i]; col.FieldName = ass[i]; col.Visible = true; col.VisibleIndex = i; gdv.Columns.Add(col); } this.gridControl1.MainView = gdv;//将gdv设置为MainView this.gridControl1.Datasource = list; //加载数据
}
public class Apple
{
private int size;
public int Size
{
get;set;
}
private int brand;
public int Brand
{
get;set;
}
}
相关文章推荐
- [C#] 动态生成GridView的列
- C# 动态生成GridView的列
- [C#] 动态生成GridView的模版列TemplateField,并在模版列TemplateField中添加复选框CheckBox
- [C#] 动态生成GridView的列
- VB.NET动态加载C#或VB.NET生成的DLL文件调用动画教程[黑白智慧写](动态调用DLL).txt
- C# WinForm 用MenuStrip动态生成菜单并动态加载事件
- c#“对于不返回任何基表信息的 SelectCommand 不支持动态 SQL 生成”错误的解决
- [C#] 动态生成GridView的列
- DevExpress.XtraGrid.GridControl GridView 根据条件动态改变 RepositoryItemButtonEdit 的Caption
- C#中"对于多个基表不支持动态SQL生成"的错误原因
- VB.NET动态加载C#或VB.NET生成的DLL文件调用动画教程[黑白智慧写](动态调用DLL).txt
- wp7使用C#通过后台动态生成Grid网格布局
- C#动态生成gridview
- EXTJS学习系列提高篇:第一篇(转载)作者殷良胜,用EXT2.2+vs.2008.net+C#动态生成GridPanel
- C#实现DataGrid(GridView)动态生成列
- Windows Phone 7使用C#通过后台动态生成Grid网格布局
- (C#)利用反射动态调用类成员、动态加载控件以及插件编程思想
- 笔记 C# 实现后台 动态加载 页面标题 Dynamic Load Page Title
- 如何动态加载控件以及插件编程思想(C#)
- ASP.NET动态加载用户控件的页面生成过程