VentureFree
Well-known member
- Joined
- Jan 9, 2008
- Messages
- 54
- Programming Experience
- 5-10
I'm trying to figure out if it's possible to get user input and update the display not when the data is entered, but when the page is loaded. For example, say I want the user to enter their name into a TextBox, which I will then display back to them on a Label. Usually I would do something like:
And then when the page reloads the label now displays the name. What I want to do instead is put the text into a session variable and change the label in Page_Load.
The problem is when I try this it doesn't update the display until the page is reloaded again. Is there a way to change the Label in Page_Load and have it show that change right away? Or do all changes of this sort have to be done before the page loads or reloads as the case may be? Note: this needs to be doable via Session variables if possible.
I know that this seems somewhat pointless, but this is really just a trivial example of something far more complex which would definitely benefit from such a thing if it is possible. Thanks for any help that you can offer (I probably won't get back until tomorrow to check on answers, though...sorry).
VB.NET:
Protected Sub txtName_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtName.TextChanged
lblName.Text = txtName.Text
End Sub
VB.NET:
Protected Sub txtName_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtName.TextChanged
Session("txtNameText") = txtName.Text
End Sub
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
lblName.Text = Session("txtNameText")
End Sub
I know that this seems somewhat pointless, but this is really just a trivial example of something far more complex which would definitely benefit from such a thing if it is possible. Thanks for any help that you can offer (I probably won't get back until tomorrow to check on answers, though...sorry).