check if user typed in asp textbox

maqskywalker
maqskywalker used Ask the Experts™
on
I'm using ASP.NET Web Forms.

In a ASP TextBox that holds a string, how do i check if a user typed in the textbox?
Sometimes the textbox might contain a string already on page load. I'm not checking if the textbox is empty.
I want to check if the user typed anything in the textbox.


So on button click if they user typed anything in the textbox

Then set this variable CheckTextBoxTyped = "Yes"

If nothing was typed in the texbox set this variable CheckTextBoxTyped = "No"


Right now i have this:



    Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

    Dim CheckTextBoxTyped As String

    CheckTextBoxTyped = "Yes"


    CheckTextBoxTyped = "No"

    End Sub
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Director, Information Systems
Commented:
On Page_Load, capture the value of the textbox.  When the user submits the page, see if the value of the textbox is the same as the stored value.  If they're the same, you can presume the user typed nothing.  If they're different, you know they did.

Author

Commented:
thanks

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial