G
Guest
I have a C# Web application that has 1 Web form that has 2 command buttons on
it with a label for output. I have a form level variable declared String
strName = "Jim"; right below where the buttons are declared by the form
designer. I have two event methods for my 2 command buttons. In the
Button1_Click event method I change the value of the form level variable
strName = "Kevin";. In the second event method, Button2_Click I check to see
if strName == "Jim", if so the label displays "failure", but if strName ==
"Kevin" the label displays "success".
Now, when I click on Button1, then click on Button2 the label displays
"failure". Why is my form level variable getting cleared out on the post
back? I have three different applications that are showing the same
symptoms. Please, can somebody shed some light?
it with a label for output. I have a form level variable declared String
strName = "Jim"; right below where the buttons are declared by the form
designer. I have two event methods for my 2 command buttons. In the
Button1_Click event method I change the value of the form level variable
strName = "Kevin";. In the second event method, Button2_Click I check to see
if strName == "Jim", if so the label displays "failure", but if strName ==
"Kevin" the label displays "success".
Now, when I click on Button1, then click on Button2 the label displays
"failure". Why is my form level variable getting cleared out on the post
back? I have three different applications that are showing the same
symptoms. Please, can somebody shed some light?