Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. TextBox value doesn't change !

TextBox value doesn't change !

Scheduled Pinned Locked Moved ASP.NET
questioncsharpasp-nethelp
5 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    Hadi Rezaee
    wrote on last edited by
    #1

    Hi there :) I'm very newbe in ASP.NET so plz excusme for my crazy question :-O I've a TextBox in my web form, and i set an initial value to the textbox in Page_Load function. private void Page_Load(object sender, System.EventArgs e) { TextBoxSubject.Text = "Metallica !" } I add a button in my page and i try to get textbox value in the button event handler. Well, everything seems fine, right ? The WebApp compiled fine ... and i run the web application. The problem is when i change the textbox value and push the button the web application displays the old value, i mean "Metallica !" :confused: How can i solve this ? Regards, Hadi

    M 2 Replies Last reply
    0
    • H Hadi Rezaee

      Hi there :) I'm very newbe in ASP.NET so plz excusme for my crazy question :-O I've a TextBox in my web form, and i set an initial value to the textbox in Page_Load function. private void Page_Load(object sender, System.EventArgs e) { TextBoxSubject.Text = "Metallica !" } I add a button in my page and i try to get textbox value in the button event handler. Well, everything seems fine, right ? The WebApp compiled fine ... and i run the web application. The problem is when i change the textbox value and push the button the web application displays the old value, i mean "Metallica !" :confused: How can i solve this ? Regards, Hadi

      M Offline
      M Offline
      Mazdak
      wrote on last edited by
      #2

      Salam :-) Change your line of code in your Load to this:

      if(!IsPostBack)
      {
      TextBoxSubject.Text = "Metallica !"

      }

      And read the IsPostBack property in MSDN, if you have problem with taht just let me know. Mazy You're face to face, With the man who sold the world - David Bowie

      H 1 Reply Last reply
      0
      • H Hadi Rezaee

        Hi there :) I'm very newbe in ASP.NET so plz excusme for my crazy question :-O I've a TextBox in my web form, and i set an initial value to the textbox in Page_Load function. private void Page_Load(object sender, System.EventArgs e) { TextBoxSubject.Text = "Metallica !" } I add a button in my page and i try to get textbox value in the button event handler. Well, everything seems fine, right ? The WebApp compiled fine ... and i run the web application. The problem is when i change the textbox value and push the button the web application displays the old value, i mean "Metallica !" :confused: How can i solve this ? Regards, Hadi

        M Offline
        M Offline
        Mazdak
        wrote on last edited by
        #3

        By the way: emaile mano gerefti? :-D Mazy You're face to face, With the man who sold the world - David Bowie

        H 1 Reply Last reply
        0
        • M Mazdak

          Salam :-) Change your line of code in your Load to this:

          if(!IsPostBack)
          {
          TextBoxSubject.Text = "Metallica !"

          }

          And read the IsPostBack property in MSDN, if you have problem with taht just let me know. Mazy You're face to face, With the man who sold the world - David Bowie

          H Offline
          H Offline
          Hadi Rezaee
          wrote on last edited by
          #4

          Salam Dear Mazdak :) Thanks aloooot for reply ! Yea, It works fine now ;) Regards, Hadi

          1 Reply Last reply
          0
          • M Mazdak

            By the way: emaile mano gerefti? :-D Mazy You're face to face, With the man who sold the world - David Bowie

            H Offline
            H Offline
            Hadi Rezaee
            wrote on last edited by
            #5

            Bale, alan Reply mizanam ;)

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups