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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T20:03:59+00:00 2026-06-15T20:03:59+00:00

I have such a page <form runat=server id=NewForm> Name: <asp:TextBox ID=Name runat=server></asp:TextBox> <asp:Button ID=AddNewName

  • 0

I have such a page

<form runat="server" id="NewForm">
    Name: <asp:TextBox ID="Name" runat="server"></asp:TextBox>
    <asp:Button ID="AddNewName" runat="server" Text="Add" OnClick="AddNewName_Click" />
    <asp:Label ID="NewName" runat="server"></asp:Label>
</form>

In the code behind, I have a Page_Load which assign a value to the TextBox Name.

protected void Page_Load(object sender, EventArgs e)
{
    Name.Text = "Enter Your Name Here";
}

Then upon the Click on the button AddNewName, I will write it in the Label NewName

protected void AddNewDivision_Click(object sender, EventArgs e)
{
    NewName.Text = Name.Text;
}

But, no matter what I input in the Name TextBox, the Label only displays “Enter Your Name Here”. It never updates to the actual content in the Name TextBox. What am I doing wrong with this code?

  • 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-15T20:04:01+00:00Added an answer on June 15, 2026 at 8:04 pm

    The problem is that you are always overwriting the changed value in Page_Load. Instead, check the IsPostBack property:

    protected void Page_Load(object sender, EventArgs e)
    {
        if(!IsPostBack)
            Name.Text = "Enter Your Name Here";
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a aspx page which contains the following CheckBoxList. <form id=form1 runat=server> <asp:CheckBoxList
I have such a link in JSP page with encoding big5 http://hello/world?name=婀ㄉ And when
Assume I have a such json setting: { page:1, items:[ { name: 'item1', id:1
I have a Razor/ASP/MVC3 web application with a form and a Submit button, which
I have links on the side of my page such as home, news, contacts,
i have many events such as $('.hidefile').click(function (event) { On page load and on
I have a page consisting of many elements with alphanumeric ids such as this:
I have thumbnails on a page, as such: <div id=credits> <a href=largeimage1.jpg alt=credits1.php><img src=thumb1></a>
I swear, I have this exact thing working on another page. I'm such a
Supposing I had a multi-form page such as: <form id=A class=jaxy ... /> <form

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.