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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T04:32:08+00:00 2026-06-05T04:32:08+00:00

I am writing ASP.NET project in C#. The UpdateUserInfo.aspx page consists textboxes and button.

  • 0

I am writing ASP.NET project in C#.

The UpdateUserInfo.aspx page consists textboxes and button. In pageLoad() method I set some text to the textbox and when button is cicked I get the new value of textbox and write it into DB.

The problem is even if I have changed the value of textbox textbox.Text() method returns the old value of textbox (“sometext”) and write this into DB.

Here the methods:

protected void Page_Load(object sender, EventArgs e)
{
    textbox.text = "sometext";
}

void Btn_Click(Object sender,EventArgs e)
{
    String textbox_text = textbox.text();// this is still equals "somevalue", even I change the textbox value
    writeToDB(textbox_text);
}

So, how to make textbox to appear with somevalue initially, but when user changes this value getText method return the new changed value and write this into DB?

  • 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-06-05T04:32:09+00:00Added an answer on June 5, 2026 at 4:32 am
    protected void Page_Load(object sender, EventArgs e)
    {
       if(!Page.IsPostBack)
        {
           textbox.text = "sometext";
        }
    }
    

    Postback is setting the textboxs text property back to "somevalue" on button click, you’ll want to set the value only once as above.

    Postback explained:

    In the context of ASP web development, a postback is another name for
    HTTP POST. In an interactive webpage, the contents of a form are sent
    to the server for processing some information. Afterwards, the server
    sends a new page back to the browser.

    This is done to verify passwords for logging in, process an on-line
    order form, or other such tasks that a client computer cannot do on
    its own. This is not to be confused with refresh or back actions taken
    by the buttons on the browser.

    Source

    Reading up on View State will also be helpful in understanding how it all fits together.

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

Sidebar

Related Questions

I'm writing am ASP.NET/C# project, it's a simple blog page with commnents. Problem I'm
I am writing a learning project in ASP.NET MVC. I have a page Books
I have ASP.NET MVC3 project and I am writing some extension methods that returns
I have a multi-project ASP.NET + C# solution. I was planning on writing a
Whilst practicing some TDD at work for an ASP.Net MVC project, I ran into
In ASP.NET MVC 2 project, how might I go about writing a custom view
I'm writing service which will use for sending emails in my ASP.NET project. I
I'm re-writing an Asp.Net project that a colleague had done a prototype version of.
Coders, I am in process of writing test cases for Asp.net MVC 3 project
I'm writing a project in c# asp.net mvc3, and I have a helper-class that

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.