boydrek
2/3/2009 10:35:00 PM
Hi,
I have a user control myUC defined as follows:
cs file:
namespace myNamespace
{
public partial class myUC : System.Web.UI.UserControl
{
....
}
}
ascx file:
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="myUC.ascx.cs"
Inherits="myNamespace.myUC" %>
<someCode>
....
</someCode>
And i have a static class MyHelperClass in which i want to do something like
this:
using ... //all the using statements needed
using myNamespace;
public static class MyHelperClass
{
public static void MyMethod(Control parent)
{
myUC uc = (myUC) parent.Page.LoadControl("path to myUC control")
;
parent.Controls.Add(uc);
}
}
in which i want to dynamically add my user control to the parent control
given to the method.
The problem is that my user control is not visible in the MyHelperClass and i
get a "are you missing a using directive or an assembly reference" error.
Anyone know why this happens or how to get around it?