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 Replies
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
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:
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,
r pPosted May 27, 2009, 9:19 AM
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:
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 ChakrabortyPosted May 26, 2009, 4:35 PM
string username = ((LoginArea.FindControl("L