• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 221
  • Last Modified:

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.
0
shanemay
Asked:
shanemay
  • 2
1 Solution
 
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
 
shanemayAuthor Commented:
Thank you, that was it.  I do not know how I missed it, but that solved it. Again, Thank you.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now