How to access asp controls inside a loginview

L

LLars

Hey,

I have the following problem: I have an asp-page which contains a loginview
with two templates (loggedin- and anonymoustemplate). How can I access a
textbox inside the the loggedintemplate from the code behind c# module?

I tried: (TextBox)Page.FindControl("TextBox1") but that will result in a
null pointer.
I also tried:
(TextBox)Page.FindControl("ContentPlaceHolder1.LoginView1.TextBox1") with the
same result.

Any ideas what I can try next?

LLars
 
B

Bob Barrows [MVP]

LLars said:
Hey,

I have the following problem: I have an asp-page which contains a
loginview with two templates (loggedin- and anonymoustemplate). How
can I access a textbox inside the the loggedintemplate from the code
behind c# module?

Umm, you don't have an "asp-page": you have an "aspx-page". There is a
difference.

There was no way for you to know it, but this is a classic asp newsgroup.
While you may be lucky enough to find a dotnet-savvy person here who can
answer your question, you can eliminate the luck factor by posting your
question to a newsgroup where the dotnet-savvy people hang out. I suggest
microsoft.public.dotnet.framework.aspnet.
I tried: (TextBox)Page.FindControl("TextBox1") but that will result
in a null pointer.
I also tried:
(TextBox)Page.FindControl("ContentPlaceHolder1.LoginView1.TextBox1")
with the same result.
No clue. I have not played with .Net 2.0 yet.
 
L

LLars

Hey Bob,

thank you for the tip with a better newgroup. I thought asp and general was
the right ony, but I see that your suggestion is a much better one.

By the way, I found out that I can access all controls if I use the
FindControl method on the Masterpage. If the trace directive is set to true,
the structure can be seen. I write this, just in case someone reads the
question and hopes for an answer.

Thanks again Bob.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top