asp.net page view

  • Thread starter Thread starter ervin
  • Start date Start date
E

ervin

I developed an application that search a db. I have a
search page that has textbox, command button, and label.
when the user enter nothing in the textbox and hit the
button, the label will display an error. How can I change
the label text to nothing when the user enters something
in the textbox or when the user use the back arrow to go
back to the search form.


thanks
 
In your button click event put some code like this:

If MyTextBox.Text.Length>0 Then MyLabel.Text=""
 
You might want to use JavaScript:
in the TextBox1-OnFocus event you clear the Label
 
Hi,

If you want to clear the label text while editing the
textbox, you have to use Javascript (onchange) event for
the textbox.
Also call the same method from body onload, so that while
clicking the back button that will be cleared.

Please consider the label name is asp.net getenrated
page..you can use the following lines...
var controls = document.getElementsByTagName('INPUT');
for (var i=0; i<controls.length; i++)
{
if (controls.type=="text")
{
var qnty = controls.value;
if(controls.name.substring(n,n)=="your text name")

Let me know if you need help.

regards
Sreejumon[MVP]
www.mstechzone.com
 
Back
Top