How to access asp controls inside a loginview

Discussion in 'ASP General' started by LLars, Feb 13, 2006.

  1. LLars

    LLars Guest

    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
     
    LLars, Feb 13, 2006
    #1
    1. Advertising

  2. LLars wrote:
    > 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.

    --
    Microsoft MVP -- ASP/ASP.NET
    Please reply to the newsgroup. The email account listed in my From
    header is my spam trap, so I don't check it very often. You will get a
    quicker response by posting to the newsgroup.
     
    Bob Barrows [MVP], Feb 13, 2006
    #2
    1. Advertising

  3. LLars

    LLars Guest

    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.


    "Bob Barrows [MVP]" wrote:

    > LLars wrote:
    > > 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.
    >
    > --
    > Microsoft MVP -- ASP/ASP.NET
    > Please reply to the newsgroup. The email account listed in my From
    > header is my spam trap, so I don't check it very often. You will get a
    > quicker response by posting to the newsgroup.
    >
    >
    >
     
    LLars, Feb 14, 2006
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?Q2FzZXk=?=

    inside the loginview

    =?Utf-8?B?Q2FzZXk=?=, Jan 13, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    477
    =?Utf-8?B?Q2FzZXk=?=
    Jan 13, 2006
  2. wikkiwikkiwaa
    Replies:
    2
    Views:
    12,699
    wikkiwikkiwaa
    Aug 9, 2006
  3. Jacob Donajkowski
    Replies:
    0
    Views:
    404
    Jacob Donajkowski
    Mar 8, 2007
  4. sunfire
    Replies:
    0
    Views:
    352
    sunfire
    Jun 14, 2007
  5. Jack
    Replies:
    1
    Views:
    972
    Alessandro Zifiglio
    Jul 3, 2006
Loading...

Share This Page