Adding an unbound - row to a specific index - datagridview bound mode

  • Thread starter Thread starter inpuarg
  • Start date Start date
I

inpuarg

Is it possible that - or is there any workarround for adding a new unbound row
to a datagridview at bound mode ?
Theese are not working. And i don 't want to add a row to dataset then rebind -
cause i want to add this row to a specific location. and it does not match to
sort order.

Regards. and thanks.

base.Rows.InsertCopy(base.CurrentRow.Index, 1);
base.Rows.Insert(base.CurrentRow.Index, 1);
base.Rows.AddCopies(base.CurrentRow.Index, 1);
base.Rows.InsertCopy(base.CurrentRow.Index, 1);
 
inpuarg,

Well, in order to do this, you have to set your sort order such that the
row will be placed in the order that you desire.

The order of the rows in the data table have nothing to do with the sort
order on a view. You need to change the view so that the sort order will
expose the rows in the order you wish.

Hope this helps.
 
well - i 've tried but i have some problems :

DataSet ds = (DataSet)base.DataSource;
DataTable dt = ds.Tables[0];
DataView dv = dt.DefaultView;

DataRow row = dv.Table.NewRow();
row["ID"] = System.Guid.NewGuid().ToString().ToUpper();

dv.Table.Rows.InsertAt(row, base.CurrentRow.Index + 1);


but when user change the default sort this is not working - what can i do ?
 
Back
Top