How to hide label ?
-
Hi i created customed login page. it has one label to show error message like "incorrect login". it also has validation summary for username and password. if user fill incorrect login name and password, the label will show "incorrect login". if login name text box or password text box miss to fill, it will show only validation summary. when i fill wrong data, it shows error msg. and i ommit one textbox or both(username and password), it show both of validation summary and error msg(label). i dont' want to show error msg if the page is not valid. i also checked "if(page.Isvalid)". but error msg(label )remain the same. any suggestion pls? i m using asp.net 2.0 and VS2005. thanks in advance!
-
Hi i created customed login page. it has one label to show error message like "incorrect login". it also has validation summary for username and password. if user fill incorrect login name and password, the label will show "incorrect login". if login name text box or password text box miss to fill, it will show only validation summary. when i fill wrong data, it shows error msg. and i ommit one textbox or both(username and password), it show both of validation summary and error msg(label). i dont' want to show error msg if the page is not valid. i also checked "if(page.Isvalid)". but error msg(label )remain the same. any suggestion pls? i m using asp.net 2.0 and VS2005. thanks in advance!
On Client side Labels are render as "SPAN" tag. So write a javascript method which set an empty string to the control on your button click
function clearControls()
{
var ctrl = document.getElementById('labelname');
if (ctrl != null)
{
ctrl.innerHTML = '';
}
}Call the above method on button click
It would be great if you turn off the ViewStatate for this particular labe1.
-
Hi i created customed login page. it has one label to show error message like "incorrect login". it also has validation summary for username and password. if user fill incorrect login name and password, the label will show "incorrect login". if login name text box or password text box miss to fill, it will show only validation summary. when i fill wrong data, it shows error msg. and i ommit one textbox or both(username and password), it show both of validation summary and error msg(label). i dont' want to show error msg if the page is not valid. i also checked "if(page.Isvalid)". but error msg(label )remain the same. any suggestion pls? i m using asp.net 2.0 and VS2005. thanks in advance!
So you want to only show the error message when the login is not in the database. If they dont enter anything and click a button you want a required field validator to fire, is that correct? Just add a required field validator to the control and that will check if the field contains a value.
-
So you want to only show the error message when the login is not in the database. If they dont enter anything and click a button you want a required field validator to fire, is that correct? Just add a required field validator to the control and that will check if the field contains a value.
thanks for your answer. yes. i alredy put required field validator. if page is not valid, validation summary show error msg. if page is valid and it is incorrrect login, lable will show "incorrect login". after displaying label, it's not disappear.my problem is like that. thanks again.
-
On Client side Labels are render as "SPAN" tag. So write a javascript method which set an empty string to the control on your button click
function clearControls()
{
var ctrl = document.getElementById('labelname');
if (ctrl != null)
{
ctrl.innerHTML = '';
}
}Call the above method on button click
It would be great if you turn off the ViewStatate for this particular labe1.
-
thanks for your answer. yes. i alredy put required field validator. if page is not valid, validation summary show error msg. if page is valid and it is incorrrect login, lable will show "incorrect login". after displaying label, it's not disappear.my problem is like that. thanks again.