码迷,mamicode.com
首页 > 其他好文 > 详细

DevExpress GridControl List绑定方式下新增行的方法

时间:2014-09-11 19:18:42      阅读:128      评论:0      收藏:0      [点我收藏+]

标签:style   blog   color   数据   div   sp   log   on   c   

List<Person> gridDataList = new List<Person>();  //此处是数据源 List集合

BindingList<Person> list = new BindingList<Person>(gridDataList); // 将List转换为BindList 
 
gridControl.DataSource = list ; // 将BindList 绑定到GridView
//新建一行
gridView1.AddNewRow(); //如果直接绑定 本方法将无效, 只有绑定方式为 DataSet DataTable 和 BindList 才能触发此函数效果.
//还有一种方式
BindingSource bdSource = new BindingSource();
bdSource.DataSource = gridDataList;
gridControl.DataSource = bdSource;

//此种方式 也能调用GridView自身的新增 AddNewRow 函数

 

DevExpress GridControl List绑定方式下新增行的方法

标签:style   blog   color   数据   div   sp   log   on   c   

原文地址:http://www.cnblogs.com/ylsoo/p/3967047.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!