submit inputs from GridView Textbox
I want to gather inputs from Gridview textboxes and update the database with the inputs. I can't simply write a get() method to retrieve textbox inputs in this case. Can you shed me some light on how to get start with this? Thanks.
Code:
<asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True"
AutoGenerateColumns="False" Font-Names="Verdana" Font-Size="9pt" OnPageIndexChanging="GridView1_PageIndexChanging"
OnSelectedIndexChanged="GridView1_SelectedIndexChanged"
OnRowDataBound="GridView1_RowDataBound" OnSorting="GridView1_Sorting"
PageSize="5">
<Columns>
<asp:TemplateField HeaderText="ID" SortExpression="ID">
<ItemTemplate>
<asp:Label ID="ID" runat="server" Text='<%# Eval("ID") %>' Width="80px"></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="LastName" SortExpression="LastName">
<ItemTemplate>
<asp:Label ID="LastName" runat="server" Text='<%# Eval("LastName") %>' Width="80px"></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="FirstName" SortExpression="FirstName">
<ItemTemplate>
<asp:Label ID="FirstName" runat="server" Text='<%# Eval("FirstName") %>' Width="80px"></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="UserInput" SortExpression="UserInput">
<ItemTemplate>
<asp:TextBox ID="UserInput" runat="server" Text='<%# Eval("UserInput") %>'
Width="80px"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
Re: submit inputs from GridView Textbox
Assuming you have a button outside of the GridView that should do all of the submitting... in the click event of that button, loop through every DataRow in the GridView and pull out the text box, doing whatever you need to with its' value.