I am trying to access Username textbox(which is in a LoginView control) in the above code in order to show a message. Can anyone please tell me how to access the UserName textbox in the LoginView? I am trying the following way, but it gives me error.
TargetControlID="UserName" WatermarkText="Please enter your Username" WatermarkCssClass="watermarked" />
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.
r pRank #4,639 · 333 reputationPosted May 27, 2009, 5:19 AM EDT
0
Thanks Niradeep, it gives me the following error:-
Object reference not set to an instance of an object.
Description:
An unhandled exception occurred during the execution of the current web
request. Please review the stack trace for more information about the error and
where it originated in the code.
Exception Details:
System.NullReferenceException: Object reference not set to an instance of an
object.
Source Error:
CSS
Line27:
Line 28:
Line 29: string username = ((LoginView1.FindControl("Login1") as Login).FindControl("UserName") as TextBox).Text;
I am trying to get the watermark working, so that I can give a message which will disappear when the user clicks on the UserName textbox. Thanks,
Niradhip ChakrabortyRank #429 · 5.8K reputationPosted May 26, 2009, 12:35 PM EDT
string username = ((LoginArea.FindControl("L
r pRank #4,639 · 333 reputationPosted May 27, 2009, 5:19 AM EDT
it gives me the following error:-
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
Source Error:
Line 27: Line 28: Line 29: string username = ((LoginView1.FindControl("Login1") as Login).FindControl("UserName") as TextBox).Text;I am trying to get the watermark working, so that I can give a message which will disappear when the user clicks on the UserName textbox.
Thanks,