TextBox value doesn't change !
-
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 -
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, HadiSalam :-) 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
-
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 -
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
Salam Dear Mazdak :) Thanks aloooot for reply ! Yea, It works fine now ;) Regards, Hadi
-
By the way: emaile mano gerefti? :-D Mazy You're face to face, With the man who sold the world - David Bowie
Bale, alan Reply mizanam ;)