Converting Asp.Net GridView with controls to DataTable
<p>Coding Problem:</p>

<p>Converting a Asp.Net GridView that has controls back into a data table</p>

<p>Real World Problem:</p>

<p>Google did not have any really useful answers I could find and implement</p>

<p>Asp.Net GridView:</p>

<pre><code>&lt;asp:GridView ID="gvCompanies" runat="server" AutoGenerateColumns="False" AllowSorting="True" OnSorting="gridView_Sorting"&gt;
            &lt;Columns&gt;
            &lt;asp:TemplateField HeaderText = "Comapny Id"&gt;&lt;ItemTemplate&gt;&lt;%# Eval("Company Id")%&gt;&lt;/ItemTemplate&gt;&lt;/asp:TemplateField&gt;
            &lt;asp:TemplateField HeaderText = "New Company Id"&gt;&lt;ItemTemplate&gt;&lt;asp:TextBox ID="TextBox5" runat ="server"&gt;&lt;/asp:TextBox&gt;&lt;/ItemTemplate&gt;&lt;/asp:TemplateField&gt;
            &lt;asp:TemplateField HeaderText = "Company Name"&gt;&lt;ItemTemplate&gt;&lt;asp:TextBox ID="TextBox6" runat ="server"&gt;&lt;/asp:TextBox&gt;&lt;/ItemTemplate&gt;&lt;/asp:TemplateField&gt;
            &lt;asp:TemplateField HeaderText = "Branch Id"&gt;&lt;ItemTemplate&gt;&lt;asp:TextBox ID="TextBox7" runat ="server"&gt;&lt;/asp:TextBox&gt;&lt;/ItemTemplate&gt;&lt;/asp:TemplateField&gt;
            &lt;asp:TemplateField HeaderText = "Location Id"&gt;&lt;ItemTemplate&gt;&lt;asp:TextBox ID="TextBox8" runat ="server"&gt;&lt;/asp:TextBox&gt;&lt;/ItemTemplate&gt;&lt;/asp:TemplateField&gt;
            &lt;asp:TemplateField HeaderText = "Location Name"&gt;&lt;ItemTemplate&gt;&lt;asp:TextBox ID="TextBox9" runat ="server"&gt;&lt;/asp:TextBox&gt;&lt;/ItemTemplate&gt;&lt;/asp:TemplateField&gt;
            &lt;asp:TemplateField HeaderText = "Prefix"&gt;&lt;ItemTemplate&gt;&lt;asp:TextBox ID="TextBox10" runat ="server" &gt;&lt;/asp:TextBox&gt;&lt;/ItemTemplate&gt;&lt;/asp:TemplateField&gt;
            &lt;asp:TemplateField HeaderText = "Sort"&gt;&lt;ItemTemplate&gt;&lt;asp:TextBox ID="TextBox11" runat ="server"&gt;&lt;/asp:TextBox&gt;&lt;/ItemTemplate&gt;&lt;/asp:TemplateField&gt;
            &lt;asp:TemplateField HeaderText = "Cash In Transit"&gt;&lt;ItemTemplate&gt;&lt;asp:TextBox ID="TextBox12" runat ="server"&gt;&lt;/asp:TextBox&gt;&lt;/ItemTemplate&gt;&lt;/asp:TemplateField&gt;
            &lt;asp:TemplateField HeaderText = "Cash Sub In Transit"&gt;&lt;ItemTemplate&gt;&lt;asp:TextBox ID="TextBox13" runat ="server"&gt;&lt;/asp:TextBox&gt;&lt;/ItemTemplate&gt;&lt;/asp:TemplateField&gt;
            &lt;asp:TemplateField HeaderText = "Cash Account"&gt;&lt;ItemTemplate&gt;&lt;asp:TextBox ID="TextBox14" runat ="server"&gt;&lt;/asp:TextBox&gt;&lt;/ItemTemplate&gt;&lt;/asp:TemplateField&gt;
            &lt;asp:TemplateField HeaderText = "Cash Sub Account"&gt;&lt;ItemTemplate&gt;&lt;asp:TextBox ID="TextBox15" runat ="server"&gt;&lt;/asp:TextBox&gt;&lt;/ItemTemplate&gt;&lt;/asp:TemplateField&gt;
            &lt;asp:TemplateField HeaderText = "Payment Method"&gt;&lt;ItemTemplate&gt;&lt;asp:TextBox ID="TextBox16" runat ="server"&gt;&lt;/asp:TextBox&gt;&lt;/ItemTemplate&gt;&lt;/asp:TemplateField&gt;
            &lt;asp:TemplateField HeaderText = "AppDB"&gt;&lt;ItemTemplate&gt;&lt;%# Eval("AppDB")%&gt;&lt;/ItemTemplate&gt;&lt;/asp:TemplateField&gt;
            &lt;/Columns&gt;
            &lt;/asp:GridView
</code></pre>
