Creating a standalone DataRowView

Hi,

I would like to create an empty DataRowView object that has the same columns as a GridDataBoundGrid. I do not want to use AddNew as I do not want the object to be added right away to the GridDataBoundGrid.

3 Replies

J. J.Nagarajan Syncfusion Team November 1, 2007 12:10 AM UTC

Hi Stephane ,

You can disable the AddNewRow by setting false to gridDataBoundGrid1.EnableAddNew property. You can use the following code snippet to have a empty data grid view.

[C#]

CurrencyManager cm = (CurrencyManager)this.gridDataBoundGrid1.BindingContext[gridDataBoundGrid1.DataSource, gridDataBoundGrid1.DataMember];
DataView dv = cm.List as DataView;
dv.Table.Rows.Add(new object[] { });


Please let me know if this helps

Regards,
Nagaraj


SD Stephane Dapsanse November 1, 2007 01:43 PM UTC

Hi Nagaraj,

Correct me if I am wrong but:
DataView dv = cm.List as DataView
dv.Table.Rows.Add(new object[] { });
will add a row to to the dataview.

I need to get a standalone DataRowView that has the same colllectio of columns as the dataview. I need something like:
DataRowView drv = dv.Table.NewRowView();

Is it possible?
Thanks,
Stephane


HA haneefm Syncfusion Team November 1, 2007 07:04 PM UTC

Hi Stephane,

Please try these code and let me know if this helps.

CurrencyManager cm = this.BindingContext[this.gridGroupingControl1.DataSource] as CurrencyManager;
DataView dv = cm.List as DataView;
DataRowView drv = dv.AddNew();

Best regards,
Haneef


Loader.
Up arrow icon