Error when trying to access User Control

T

ticars

I'm getting a weird error when trying to access a user control from
within a base page during runtime. Here's what I have:

I have a master page with a user control on it. I then have a few
webforms that provide content to the master page. All of these
webforms inherit from the same basepage which I created. Within that
base page I'm attempting to access the user control. When I try to
execute the code, it gives me an error:

"CS0246: The type or namespace name 'UserControls_MyControl' could not
be found (are you missing a using directive or an assembly reference?)"

at the point that I declare a variable of the type
UserControls_MyControl.

But during design time, it has no problem finding that class (it
doesn't show as an error and the intellisense comes up). Does anyone
know what I'm missing here???
 
K

Karl Seguin [MVP]

is this in 2005?

You need to add a @Reference directive

<%@ Reference Control="yourcontrol.ascx" %>

Karl
 

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

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top