title: how to convert Gridview to Datatable
body: <p>I am using <code>GridView</code> in my application for populating datas. </p>
  
  <p>Is there any easy way to copy a gridview to datatable ?</p>
  
  <p>Actually, in my <code>GridView</code> one of the control is textbox.<br>
  So I can edit that control at any time... What I need is on the button click whatever changes I made in <code>GridView</code> has to copy in one datatable...</p>
  
  <p>I did this using the code, </p>
  
  <pre><code>dt = CType(Session("tempTable"), DataTable) 
  i = 0 For Each rows As GridViewRow In Grid1.Rows 
     Dim txt As TextBox 
     txt = CType(rows.FindControl("txt"), TextBox) 
     dt.Rows(i)(1) = txt.Text
     i = i + 1 
  Next
  </code></pre>
  
  <p>Here I am traversing through grid with the help of "for each" loop.<br>
  I am worrying whether it effects performance?<br>
  Can you please tel me any other simple method to copy a <code>GridView</code> to a datatable</p>