troubleshooting Question

ASP.NET TextBox won't keep value?  Very Confused.

Avatar of Crazy_Penguins
Crazy_Penguins asked on
.NET ProgrammingVisual Basic.NET
2 Comments1 Solution502 ViewsLast Modified:
Can't get a test box to keep values when I want to read them in my code.

Problem easy to reproduce!

Steps - create new aspx page, drag on a textbox, button, another textbox

Clicking button on middle, should, with the code below, copy the test in box 1 to box 2 - be sure to change the text to something other than 'hello' - and it will revert back to 'hello' every single time.  Do it any way you want, press enter, press the button, do it while half asleep working on a project late into the night...

Thanks for any help - Andrew
Partial Class TestPage
    Inherits System.Web.UI.Page
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Me.TextBox1.Text = "hello"
    End Sub
    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
        Me.TextBox2.Text = Me.TextBox1.Text
    End Sub
End Class

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 2 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros