Accessing Controls in LoginView

Discussion in 'ASP .Net Web Controls' started by Steve Harp, Feb 22, 2007.

  1. Steve Harp

    Steve Harp Guest

    Hi All,

    This should be easy. I have a LoginView control on my default page.
    Within the LoggedInTemplate, I have a DropDownList control. From my
    code-behind cs file (in the DropDownList_SelectedIndexChanged method),
    how can I access the DropDownList to see what selection was made? A
    small code snippet would be very helpful.

    Thanks,
    Steve
     
    Steve Harp, Feb 22, 2007
    #1
    1. Advertising

  2. Steve Harp

    Teemu Keiski Guest

    If that event is already raised ok, and it is raised by the DropDownList you
    want to access, just get it via sender argument e.g you have

    protected void DropDownList1_selectedIndexChanged(object sender, EventArgs
    e)
    {
    DropDownList list=(DropDownList)sender;
    //Do something with the DDL
    }

    E.g in .NET object raising the event is always accessible via the sender
    argument. Wiring event handlers with that signature is standard in .NET.

    --
    Teemu Keiski
    AspInsider, ASP.NET MVP
    http://blogs.aspadvice.com/joteke
    http://teemukeiski.net





    "Steve Harp" <> wrote in message
    news:...
    > Hi All,
    >
    > This should be easy. I have a LoginView control on my default page.
    > Within the LoggedInTemplate, I have a DropDownList control. From my
    > code-behind cs file (in the DropDownList_SelectedIndexChanged method),
    > how can I access the DropDownList to see what selection was made? A
    > small code snippet would be very helpful.
    >
    > Thanks,
    > Steve
     
    Teemu Keiski, Feb 25, 2007
    #2
    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. Davie
    Replies:
    5
    Views:
    22,045
    Petulka77
    Sep 30, 2007
  2. Christopher W.

    accessing labels in a loginview....

    Christopher W., Jul 14, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    344
    Christopher W.
    Jul 14, 2006
  3. wikkiwikkiwaa
    Replies:
    2
    Views:
    12,583
    wikkiwikkiwaa
    Aug 9, 2006
  4. sunfire
    Replies:
    0
    Views:
    336
    sunfire
    Jun 14, 2007
  5. sunfire
    Replies:
    0
    Views:
    348
    sunfire
    Jun 14, 2007
Loading...

Share This Page