I have a gridview in VS 2005. The grid is displayed in textboxes, so the user can edit.
<asp:TemplateField ItemStyle-Width="50">
<ItemTemplate>
<asp:TextBox ID="txtSmall" runat="server" Width="45px" Text='<%#DataBinder.Eval(Container.DataItem,"Small") %>' OnTextChanged="TxtSmallChanged"> </asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField ItemStyle-Width="50">
<ItemTemplate>
<asp:TextBox ID="txtMedium" runat="server" Width="45px" Text='<%#DataBinder.Eval(Container.DataItem,"Medium") %>' OnTextChanged="TxtMediumChanged"> </asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField ItemStyle-Width = "50">
<ItemTemplate>
<asp:TextBox ID="txtTotal" runat="server" Width="45px" Text='<%#DataBinder.Eval(Container.DataItem,"Total") %>'> </asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
Whenever the textbox txtsmall or txtmedium changes(numbers), the Textbox txttotal has to get updated as total of both in txtSmall and txtmedium. I am using a function TxtSmallChanged when text in it is changed. How do i write the codebehind function to update the txtTotal. I hope i am clear. Thank you so much!!
Try This:
Set Autopostback=true
You Can update database with new values in the Txtchanged