Rashmi S Rashmi S - 1 year ago 175
C# Question

Convert dataRowview to dataTable in c#

I am trying to convert dataRowview into Datatable:

private void Cell_Edit_End(object sender, DataGridCellEditEndingEventArgs e)
DataRowView rowView = e.Row.Item as DataRowView;
rowBeingEdited = rowView;
DataTable dt = new DataTable();
foreach (DataRow row in rowBeingEdited.Row.GetChildRows) {

Can anyone help me to solve.

Answer Source

We can directly convert dataRowview into Datatable as:

 DataTable dt = rowBeingEdited.DataView.ToTable();
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download