[英]Row not adding in grid control devExpress
am adding row in grid control through column view. 我通过列视图添加网格控件中的行。 But it is not working.
但它没有用。 Even though I am providing correct information.
即使我提供正确的信息。
private void Home_Load(object sender, EventArgs e)
{
int counter;
readStudent();
ColumnView view = gridControl1.FocusedView as ColumnView;
foreach (PAT p in pt_list)
{
String s1 = p.name;
view.AddNewRow(); //Problem here:not adding row
int count = view.RowCount-1;
view.SetRowCellValue(view.GetRowHandle(count), "PAT Name", s1);
foreach(Student1 student in st_lst)
{
counter = 1;
foreach (Allocate al in al_list) {
if (p.ID == al.AID && student.UOB == al.AUOB)
{
String s = student.name;
view.SetRowCellValue(view.GetRowHandle(count), "Student "+ counter, s);
counter++;
}
}
}
gridControl1.DataSource = view;
}
can anybody help me with that 任何人都可以帮助我
I don't think this is still active but you cannot use the GridView
as gridControl1.DataSource
. 我不认为这仍然是活动的,但您不能将
GridView
用作gridControl1.DataSource
。 This has to be a data-construct and not a sub-part of the GridControl itself. 这必须是数据构造,而不是GridControl本身的子部分。 So use a list of objects or a DataTable as dataSource and add your new student there.
因此,使用对象列表或DataTable作为dataSource,并在那里添加新学生。
See the DevExpress help on how to bind a list of objects. 有关如何绑定对象列表的信息,请参阅DevExpress帮助 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.