Controls will not release state.

I am creating an update form to update user profiles, however, when I click the submit button, the controls on the page are not holding the new values, they revert to the values they were assigned when the page loaded.  I am not sure why this is happening.  

Any help would be greatly appreciated, Thank you.
shanemayAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

shanemayAuthor Commented:
I thought I would leave an example,

txtEmailAddress is a Text Box Control assigned the users email address on page load.  When the user changes the email address and clicks submit, my code behind the submit button

string emailAddress = txtEmailAddress.Text, pulls the email address that was originally loaded with the page and not the corrected or new email address the user entered.  


I hope this makes it more clear.  Again, thank you for any help or advice.
0
David RobitailleAnalyst ProgrammerCommented:
hummm on  page load?
did you check if it s a post back (using Page.IsPostBack) before seting the fields??
if not, the textbox are reset in the page load event (that occurs on submit)

 Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not (Page.IsPostBack) Then
              'your stuff
        End If
       
    End Sub

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
shanemayAuthor Commented:
Thank you, that was it.  I do not know how I missed it, but that solved it. Again, Thank you.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.