Setting properties of a control on a usercontrol from a page



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

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.

Best regards,
Dave Colliver.
~~ - Local franchises available


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