Hi there,
There are at least two ways to fix this.
1. When you have place the control on the design / code surface of the page, there really isn't a reason to New up a new instance of the control. Just reference it by its ID in the markup and access its properties like this:
TopNav1.AdminButtonColor = "#FFFFFF"
This assumes you have a control of type TopNav with an ID of TopNav1 in your page.
2. Add a reference to the control at the top of the page near the page directive, like this:
<%@ Reference Control="TopNav.ascx" %>
or
<%@ Reference VirtualPath="~/TopNav.ascx" %>)
Then in the code behind of the page, you can now New up instances of TopNav.
Take a look here for more detailed informatioN:
http://msdn2.microsoft.com/en-us/library/w70c655a(en-US,VS.80).aspx
HtH,
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Author of
ASP.NET 2.0 Instant Results and
Beginning Dreamweaver MX / MX 2004