how to hide label msg on textbox focus

Posted by Nietajay under ASP.NET on 1/3/2012 | Points: 10 | Views : 7044 | Status : [Member] | Replies : 5
hi,
in registration page i am checking email id in database using textbox autopostback event ..
if email id exist in database this it will show a msg in a lable .. but when i am start typing again in textbox then label msg is visible .. how to hide that lable msg if i am start typing again in the textbox ..how to do this in asp.net ..


thankyou..:)

http://www.questionsofinterview.com

Ajay Kumar
Web developer



Responses

Posted by: Naimishforu on: 1/3/2012 [Member] [MVP] Bronze | Points: 25

Up
0
Down
Try the GetFocus method of a text box to hid the label message.

Thanks,
Naimish
http://dotnetinterview.zxq.net/
http://naimishpandya.blogspot.in/

Nietajay, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sksamantaray on: 1/3/2012 [Member] Silver | Points: 25

Up
0
Down
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script>
function test() {

document.getElementById('Label1').innerText = '';

return false;
}
function test2() {

document.getElementById('Label1').innerText = 'InitialValue';

return false;
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>

<asp:TextBox ID="TextBox1" onfocus="Javascript:return test()" runat="server"></asp:TextBox>
<br />
<asp:TextBox ID="TextBox2" onfocus="Javascript:return test2()" runat="server"></asp:TextBox>

<asp:Label ID="Label1" runat="server" Text="InitialValue"></asp:Label>

</div>
</form>
</body>
</html>
Try this

Thanks,
Sanjay

Nietajay, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Mustafa_9664 on: 11/9/2012 [Member] Starter | Points: 25

Up
0
Down
please rep me for the same question in vb.net. .. please.. i am trying it since past two days bt cudnt do it... Kindly help.. god bless u all...!!!!

Nietajay, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Rajesh081725 on: 11/9/2012 [Member] Bronze | Points: 25

Up
0
Down
hai,
First use the Textbox_Lost focus event to type ur code for database usage
label message hide using textbox1.visible =false it is hide
textbox1.visible=true if is visible message

Time is Gold
Thanks & Regards,
Rajesh Kumar,
9962038582.

Nietajay, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Mustafa_9664 on: 11/9/2012 [Member] Starter | Points: 25

Up
0
Down
Actully i hav placed a label for empty textbox validations.. and i want it to fade as soon as i start writing onto the textbox.. please help me with the easiest code as i am a beginner..!!! thanku..!!!

Nietajay, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response