Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7050773
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T03:11:06+00:00 2026-05-28T03:11:06+00:00

I have a gridview in VS 2005. The grid is displayed in textboxes, so

  • 0

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!!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T03:11:06+00:00Added an answer on May 28, 2026 at 3:11 am

    Try This:

    Set Autopostback=true

     protected void txtSmall_TextChanged(object sender, EventArgs e)
        {
            TextBox t = (TextBox)sender;
            GridViewRow r = (GridViewRow)t.NamingContainer;
            Txtchanged(r.RowIndex);
        }
    
        protected void txtMedium_TextChanged(object sender, EventArgs e)
        {
            TextBox t = (TextBox)sender;
            GridViewRow r = (GridViewRow)t.NamingContainer;
            Txtchanged(r.RowIndex);
        }
    
        private void Txtchanged(int row_index)
        {
            TextBox t1 = (TextBox)GridView1.Rows[row_index].Cells[0].FindControl("txtSmall");
            TextBox t2 = (TextBox)GridView1.Rows[row_index].Cells[0].FindControl("txtMedium");
            TextBox t3 = (TextBox)GridView1.Rows[row_index].Cells[0].FindControl("txtTotal");
            t3.Text = (Convert.ToInt32(t1.Text) + Convert.ToInt32(t2.Text)).ToString();
    
        }
    

    You Can update database with new values in the Txtchanged

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a gridview in asp.net using vb 2005. on Protected Overrides Sub Rendersome
I have Gridview like this. Here is my last column Gridview code; <EditItemTemplate> <asp:TextBox
I am using GridView control in asp.net 2005 c# using . How can I
I have GridView(id: gv_test) with two columns: itemId ImageButton (id: ImageBTN) <asp:ImageButton ID="ImageBTN" Width="34px"
I have a gridview inside an updatepanel. It has a TemplateField column with radiobutton:
I have gridview in my asp.net 3.5 application [C#]. Which looks like this: <asp:GridView
i have a gridview i am working on VS2008 ASP.Net forms Currently, my update
I'm using Visual Studio 2008 (Asp.net (c#)) and SQl Server 2005 I have a
I have GridView which I can select a row. I then have a button
I have GridView with Template Column.Inside the template column i have asp:hiddenfield. I am

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.