简体   繁体   中英

Add row in GridControl Devexpress onClick

我正在使用devexpress gridcontrol,我想在Click上自动生成10行,我研究了一些来源,并说它没有像标准GridView这样的属性来添加gridView.Rows.Add();

To be able to add rows in your grid :

. Your gridDataSource property should be set

. Make your view editable

 gridView1.OptionsBehavior.Editable = true;
 gridView1.OptionsView.NewItemRowPosition = NewItemRowPosition.Bottom;
   for (int i = 1; i < 10; i++)
        {
            gridView1.AddNewRow();
        }

. Set the position of the NewItemRowPosition of your view

gridView1.OptionsView.NewItemRowPosition = NewItemRowPosition.Bottom;

if you use the datatable as source you can write :

 DataTable tabe = new DataTable();
  gridControl1.DataSource = table;
  DataRow newLigne = table.NewRow();
  table.Rows.Add(newLigne);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM