Rashmi S Rashmi S - 7 months ago 101
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.


We can directly convert dataRowview into Datatable as:

 DataTable dt = rowBeingEdited.DataView.ToTable();