473,320 Members | 2,098 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

asp.net page view

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

Nov 17 '05 #1
3 1137
In your button click event put some code like this:

If MyTextBox.Text.Length>0 Then MyLabel.Text=""

--
I hope this helps,
Steve C. Orr, MCSD
http://Steve.Orr.net
Developer for Hire
"ervin" <tr*******@hotmail.com> wrote in message
news:02****************************@phx.gbl...
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

Nov 17 '05 #2
You might want to use javascript:
in the TextBox1-OnFocus event you clear the Label

"ervin" <tr*******@hotmail.com> wrote in message
news:02****************************@phx.gbl...
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

Nov 17 '05 #3
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[i].type=="text")
{
var qnty = controls[i].value;
if(controls[i].name.substring(n,n)=="your text name")

Let me know if you need help.

regards
Sreejumon[MVP]
www.mstechzone.com
-----Original Message-----
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 changethe 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

.

Nov 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Pete Wason | last post by:
Hiall! I have a demo viewer page for javascript stuff that has three buttons "DEMO" "HTML" and "JSCR", and an IFRAME called 'viewer'. Initially, the IFRAME gets loaded with the actual demo...
0
by: thomas | last post by:
Hi all, I was wandering is anyone can help. When I click on the 'view all' link on my homepage http://www.guitarmidi.co.uk I woild like to output the first 20 results on screen then have a...
2
by: Brad | last post by:
I have an intranet app that has just started sporadically getting the following error "The viewstate is invalid for this page and might be corrupted." By sproadic I mean 3-4 times during the past...
2
by: John Lau | last post by:
Hi, Is there documentation that talks about the page lifecycle, the lifecycle of controls on the page, and the rendering of inline code, in a single document? Thanks, John
4
by: Glenn M | last post by:
I have a shared XML file on a server . i also have one xslt file that performs a simple transform on in to view the data. now i want to have another page that lets users modify the shared xml...
3
by: rgparkins | last post by:
Hi This has been asked before but with no resolution so I am putting it out there again in case someone has an answer. 2 user controls with same name List.ascx but different namespace, and I...
0
by: mrjoka | last post by:
hi friends; i'm stuck in a web site and i hope you can help me. i'm working in a statistic web site where i'm using mastre page(this is the first time i'm working with master page) in this mastre...
3
by: kang jia | last post by:
hi i am doing reply page for forum, users can reply for the specific topic they would like to reply. Firstly of all, when click the topic name in topic page. i will redirect them to reply page....
21
by: karen987 | last post by:
I have a news website, with asp pages. It has publishing software which allows you to add articles in a database, and then calls them up from links etc. I have added dynamic meta tags in 2 parts. The...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.