关于GridView调用AddNewRow时无法触发InitNewRow事件
我在调用AddNewRow时无法触发GridView_InitNewRow()事件,无法添加新行,调用了该函数后gridview的rowcount没有改变,求助,不知是怎么回事。是啊,很无语。新版14.2.5-14.2.6 都是无法触发GridView_InitNewRow()事件 呃...我来挖个坟,我现在17.2貌似仍然不触发,到底肿么回事啊?{:2_25:} public override void AddBtn_ItemClick()
{
gridView1.AddNewRow();
//gridView1.OptionsView.NewItemRowPosition = NewItemRowPosition.Bottom; 属性里已经设置
}
private void gridView1_InitNewRow(object sender, InitNewRowEventArgs e)
{
GridView view = sender as GridView;
view.SetRowCellValue(e.RowHandle, "主键ID", "A282");
view.SetRowCellValue(e.RowHandle, "分组编号", "021");
view.SetRowCellValue(e.RowHandle, "分组名称", "乱七八糟");
view.SetRowCellValue(e.RowHandle, "描述", "一塌糊涂");
// gridView1.FocusedRowHandle = e.RowHandle;
//ColumnView View = sender as ColumnView;
//View.SetRowCellValue(e.RowHandle, View.Columns, gridView1.GetRowCellValue(gridView1.GetRowHandle(gridView1.RowCount - 2), gridView1.Columns)); //复制最后一行的数据到新行
////View.SetRowCellValue(e.RowHandle, View.Columns,gridView1.GetRowCellValue(gridView1.GetRowHandle(gridView1.RowCount - 2),gridView1.Columns)); //复制最后一行的数据到新行
//DataRow drnew = dt.NewRow();
//dt.Rows.Add(drnew);
//gridControl1.DataSource = dt;
//gridControl1.RefreshDataSource();
//gridView1.RefreshData();
infostock.ShowMessage("qwe");
}
“qew” 也没弹出,来个大佬拯救下!万分感激!
加一条 gridView1.UpdateCurrentRow()
页:
[1]