Setting properties of a control on a usercontrol from a page

Discussion in 'ASP .Net' started by David, Sep 20, 2010.

  1. David

    David Guest

    Hi all,

    I thought I had done this before, but it seems now, it won't work.

    I am using C# with .NET 3.5

    I have a page. My page has a menu with linkbuttons.

    I have usercontrols loaded on the page. The UC I am working with is inside a
    panel on the main page.

    When I click a specific linkbutton in the main page, a panel inside the UC
    should now become visible. (It is set to visible=false to start with).


    in my UC, I have...

    public Panel CompanyEntry

    {

    get { return CompanyEntryPanel; }

    }


    In my page, on my button click, I have...

    uc_company companyPanel = new uc_company(); // This is the user
    control.

    protected void AddNewCompany_Click(object sender, EventArgs e)
    {
    ButtonsPanel.Visible = false;

    companyPanel.CompanyEntry.Visible = true;
    }


    I am sure I have done similar before, but I can't get this to work. I get
    Object reference not set to an instance of an object on the .Visible line.

    Thanks.
    --
    Best regards,
    Dave Colliver.
    http://www.AshfieldFOCUS.com
    ~~
    http://www.FOCUSPortals.com - Local franchises available
     
    David, Sep 20, 2010
    #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. nail
    Replies:
    0
    Views:
    1,564
  2. Fabiano
    Replies:
    2
    Views:
    627
    =?Utf-8?B?c3Jpbmk=?=
    Jun 3, 2005
  3. Wardie
    Replies:
    4
    Views:
    500
    Wardie
    Nov 8, 2006
  4. Peter O'Connell

    Setting Control Properties with a Control Builder

    Peter O'Connell, Nov 11, 2004, in forum: ASP .Net Building Controls
    Replies:
    1
    Views:
    127
    Peter O'Connell
    Nov 16, 2004
  5. Iams

    setting control properties based on another control

    Iams, Mar 17, 2005, in forum: ASP .Net Datagrid Control
    Replies:
    0
    Views:
    126
Loading...

Share This Page