如何在Devexpress gridview中添加新行,当我们从List <citem> objlst </citem>设置DataSource时

时间:2012-07-10 05:52:47

标签: c# linq

如何在Devexpress gridview中添加新行,当我们从List objlst设置DataSource时 我想在运行时添加新行。

private void SetData()
{
    List<CITEM> lstItem = new List<CITEM>();

    gridControl1.DataSource = lstItem;

    gridView1.PopulateColumns();
}

private void button1_Click(object sender, EventArgs e)
{
    gridView1.AddNewRow();
}

2 个答案:

答案 0 :(得分:0)

如果您将列表更改为绑定列表

,它将起作用

答案 1 :(得分:0)

def everyone_sign(names):

    message = "Thank You!, Your Friends, "
    message_Dict = {}
    for idx, name in enumerate(names):
        message_Dict[name] = message + ", ".join(names[:idx] + names[idx+1:])    #list slicing
    return message_Dict

n = ["Mike", "Dan", "Stan", "Max", "Rad", "Ned"]
print(everyone_sign(n))