access textbox value without postback

G

Guest

I have several text boxes like FirstName, LastName, etc; the usual.
When the page is loaded I fill in the values from a member record.
Like:
Session("FirstName") = DS.Tables("Member").Rows(0)("firstName") & ""
Then show in the textbox like:
Me.tbFirstName.Text = Session("FirstName")

Then what I want to do is be able to determin if the user has made a change or edit like this:
'the real question is where to put this piece of code - textchanged event?
Dim strChanges As String
If Me.tbFirstName.Text <> Session("FirstName") Then
strChanges &= "<b>First Name: </b>" & Me.tbFirstName.Text & "<br>"
End If
''''''''
Then I can carry all the changes over like this:
Session("Changes") = strChanges

My problem is that when I try to compare tbFirstName to Session("FirstName"), I'm not getting the edited value of tbFirstName. Its returning the viewstate value which makes sense but then Me.tbFirstName.Text <> Session("FirstName") is never true.

I tried to put this in the tbFirstName_textChanged event and it knows the text changed so it does execute but it still gives the unupdated viewstate value of tbFirstName not the edited value. I can't do a postback to update the value because I know the person I'm doing this for won't like it.

Is there anyway to get at the changed value without doing a complete postback?
Is there someway to update the view state here:

'the real question is where to put this piece of code
Me.viewstate.updateSomehow
Dim strChanges As String
If Me.tbFirstName.Text <> Session("FirstName") Then
strChanges &= "<b>First Name: </b>" & Me.tbFirstName.Text & "<br>"
End If
''''''''
 
T

Trevor Benedict R

I would not use the Session State to do this. Instead I would use the
ViewState to store the First value and then compare against the one in
the TextBox.

As for the TextBox I am not sure why you are not able to get at the new
value. did you try the Form_Load Event. You can do a Respose.Write of
both the values here.

Trevor Benedict R
MCSD

*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top