C# .Net - Desperately need help with a ddl in a gridview in a usercontrol

Discussion in 'Software' started by Apolta, Jun 9, 2009.

  1. Apolta

    Apolta

    Joined:
    Jun 9, 2009
    Messages:
    1
    I am doing a findcontrol on the dropdownlist, and it does not work in the page_load event, or any other user events, (the ddl always has a selected index of -1 and a null text). The ONLY event that the dropdownlist is found via the findcontrol is the selectedindexchanged event specified in the HTML. I need to be able to find the dropdownlist control earlier - such as in the page_load event or another user event.
    Here's my code:
    HTML: OnSelectedIndexChanged="ddlTEAID_SelectedIndexChanged" -
    protected void ddlTEAID_SelectedIndexChanged(object sender, EventArgs e)
    {

    DropDownList ddlTEAID = (DropDownList)gvTCCGridAE.Rows[0].FindControl("ddlTEAID");
    code...
    }
    However, when I use the same code elsewhere in the ascx.cs file, it doesn't work.
    ALso, I'm having trouble pointing to the parent form associated with the user control, because it is a master template with content holders.

    This is the content holder: ctl00$ContentPlaceHolder1$TCCGrid1$AddEmployee1$gvTCCGridAE$ctl02$ctl00


    How would I code the findcontrol, I know I have to nest the findcontrols.


    How do I code the find control - everything I've tried tells me that the specified name is out of context.
    And also, once I find the control, can you send me a sample of a nested findcontrol?
     
    Last edited: Jun 9, 2009
    Apolta, Jun 9, 2009
    #1
    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. Jay D.

    Katz DDL Forum! Join today!

    Jay D., Jul 27, 2003, in forum: Computer Support
    Replies:
    1
    Views:
    4,352
    trout
    Jul 27, 2003
  2. miss calm

    ddl/systemfile software?

    miss calm, Feb 9, 2004, in forum: Computer Support
    Replies:
    5
    Views:
    416
    Unknown
    Feb 10, 2004
  3. Guiduce

    ddl problem

    Guiduce, Aug 31, 2004, in forum: Computer Support
    Replies:
    2
    Views:
    614
    Guiduce
    Sep 1, 2004
  4. sara_23apr
    Replies:
    1
    Views:
    5,977
  5. tejesvi

    gridview inside usercontrol to XLS

    tejesvi, Apr 19, 2008, in forum: Software
    Replies:
    0
    Views:
    966
    tejesvi
    Apr 19, 2008
Loading...

Share This Page