Error when trying to access User Control

  • Thread starter Thread starter ticars
  • Start date Start date
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???
 
is this in 2005?

You need to add a @Reference directive

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

Karl
 
Back
Top