As below: I first remove records of grid,then Init grid from another DataSet,but first record can not be modified.
I just want to empty grid,then fill using Dataset's data!
//
int TotalCounts=(this.grid.BindingContext[this.grid.DataSource,this.grid.DataMember]).Count;
for(int i=0;i
AD
Administrator
Syncfusion Team
August 1, 2003 05:52 AM UTC
Are you trying to move data from a table in 1 dataset to another table using the grid? Or, do you just want to display information from this other dataset in the grid. If it is the second thing you want to do, then try just setting grid.DataSource to the table you want to see. (There is no need to physically remove the rows from the first table.)
If you really do wnat to remove the rows from teh first table, instead of that loop, try this:
this.grid.CurrentCell.MoveTo(1,1); //home the current cell
this.grid.Binder.RemoveRecords(0, TotalCounts-1);
Then you could just set:
this.grid.DataMember = "";
this.grid.DataSource = ds.Tables[0];
As far as your code, you might try adding grid.Binder.BeginEdit after your AddNew() but before you start setting the values.