ranjit9

ranjit9

  • NA
  • 4
  • 0

GridView Data to a DataTable..NET 2.0

Jun 27 2006 7:19 PM
Hi All,
Quick question. How do I get all rows from a gridview(it is not connected to any DataSet or datasource) to a DataTable(Disconnected table)?

Here is what I am trying to do. For richer user experiance I have a GridView on my Win Form,I add row(s) using gv.Rows.Add(string[],row{col1_val,col2_val...} method. Now I need to pass these rows to a custom class where I will be enumerating this set and use it for various purposes.Max the GridView will have 20 rows. So I was thinking if I can pass these rows to a DataTable and pass this table to my class, I can enumerate the rows in my class.

I know I can use for each row in GV add row to DataTable, other than this is there a method deom either of the classes(GridView, DataTable) where I can bind one another?

Can anyone help me solve this?

Thank you in advance.

--Ranjit