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 5965997
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T19:43:39+00:00 2026-05-22T19:43:39+00:00

I have a form with a few text-boxes and a Grid-view. There is this

  • 0

I have a form with a few text-boxes and a Grid-view. There is this one text-box called “Inward Number”, whose text-changed event fires all the time. When i want to fire another control’s event, it simply fires the text-changed event of the Inward Number text-box. This happens with all of the other controls. Can someone please help?

protected void txtInward_No_TextChanged(object sender, EventArgs e)
{
   a = 'A';
   NewRow();
}

I have used the correct names, but still this error occurs.

<asp:TextBox ID="txtInward_No" runat="server" Width="220px" CssClass="txtbox" 
                    EnableViewState="False" 
                    AutoPostBack="True" ontextchanged="txtInward_No_TextChanged">
</asp:TextBox>

new row just makes a new row in my grid.

private void NewRow()
{
int rowIndex = 0;

        if (ViewState["CurrentTable"] != null)
        {
            DataTable dtnew = new DataTable();
            dtnew = (DataTable)ViewState["CurrentTable"];
            DataRow drr = null;
            if (dtnew.Rows.Count > 0)
            {
                for (int i = 1; i <= dtnew.Rows.Count; i++)
                {
                    TextBox box1 = (TextBox)GridView1.Rows[rowIndex].Cells[2].FindControl("TextBox1");
                    TextBox box2 = (TextBox)GridView1.Rows[rowIndex].Cells[3].FindControl("TextBox2");
                    TextBox box3 = (TextBox)GridView1.Rows[rowIndex].Cells[4].FindControl("TextBox3");
                    TextBox box4 = (TextBox)GridView1.Rows[rowIndex].Cells[5].FindControl("TextBox4");
                    TextBox box5 = (TextBox)GridView1.Rows[rowIndex].Cells[6].FindControl("TextBox5");

                    drr = dtnew.NewRow();
                    if (txtInward_No.Text =="1")
                    {
                        drr["InwardNumber"] = txtInward_No.Text + b.ToString();                           
                    }
                    else 
                    {
                        drr["InwardNumber"] = txtInward_No.Text + a.ToString();
                    }
                    drr["Bags"] = box1.Text;
                    drr["GrossWt"] = box2.Text;
                    drr["TareWt"] = box3.Text;
                    drr["NetWt"] = box4.Text;
                    drr["DCBillWt"] = box5.Text;

                    rowIndex++;                       
                }
                dtnew.Rows.Add(drr);
                ViewState["CurrentTable"] = dtnew;
                GridView1.DataSource = dtnew;
                GridView1.DataBind();                    
            }
        }
        PrevData();
        b++;
        a++;
   }
  • 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-22T19:43:40+00:00Added an answer on May 22, 2026 at 7:43 pm

    http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.textbox.ontextchanged.aspx

    A TextBox control must persist some values between posts to the server for this event to work correctly. Be sure that view state is enabled for this control.

    Try enabling ViewState for TextBox.

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

Sidebar

Related Questions

I have a form with a list box and a few text boxes, when
I have a few text boxes and buttons on my form. Lets say txtBox1
I have a form like this: <form name=mine> <input type=text name=one> <input type=text name=two>
So I have this form that has tons of text boxes, combo boxes, etc.
I have this link that creates a few div's in which a form is
I have a form with a few buttons which execute code when pressed like
HI I have a form with a few buttons. Each button runs a few
I have a form that has a few similar controls and the parent contains
I have a few listview controls on a windows form and i've assigned a
I have form area in my view. If I click button A , I

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.