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

  • Home
  • SEARCH
  • 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 6717045
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T08:48:21+00:00 2026-05-26T08:48:21+00:00

I want to get the Text property from a TextBox that is inside a

  • 0

I want to get the Text property from a TextBox that is inside a GridView. This TextBox has some data that come from my database. When I change this data, I wanna do a Update in my database.

But when I search for the Text of my TextBox, he get the old value that come from my database and not the value that I put now.

How can I do, to get my actual data that I write in my TextBox and not that come from my databse ?

protected void VerifyPriority()
{
    for (int i = 0; i < GridView1.Rows.Count; i++)
    {
        GridViewRow RowView = (GridViewRow)GridView1.Rows[i];
        TextBox txt = (TextBox)GridView1.Rows[i].FindControl("txtPriority");

        if (txt != null)
        {
            if (txt.Text != this.changes[i])
            {
                this.UpdatePriority(this.codigo[i], txt.Text);
            }
        }
    }
}
  • 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-26T08:48:22+00:00Added an answer on May 26, 2026 at 8:48 am

    More than likely you’re you’re rebinding the GridView after every postback instead of binding it once and letting ViewState persist the data. If you bind the GridView every time the page is posted back, any changes you make will be wiped out and replaced with the information from the database.

    Do your binding on the first page load only (in this case):

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            GridView1.DataSource = GetSomeData();
            GridView1.DataBind();
        }
    }
    

    After putting the above code in place, you should be able to get the correct data from the TextBox:

    foreach (GridViewRow row in GridView1.Rows)
    {
        TextBox txt = row.FindControl("TextBox1") as TextBox;
        if (txt != null)
        {
            string value = txt.Text;
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to apply some CSS to text that I can't get marked up
I want to get text from current active line (the line where the caret
I got this url /search/renttype-all.place-all.type-all.bedrooms-all.0.0/ I want to get the text after the second
I want to get back the text that I select in an element using
I want to write the text (which I get from AJAX) to a file,
I have a windows form that sets the text property in a textbox to
How can I do this in XAML: PSEUDO-CODE: <TextBox Text={Binding Password} Type=Password/> so that
i want to get some value from xml file filtering with xml attribute. my
I have data that gets displayed in gridview. If I'm pulling it from one
In a web page,i want to get every visible text in a textnode.I don't

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.