Accessing User Controls

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • michael234
    New Member
    • Feb 2008
    • 4

    Accessing User Controls

    Hi All,

    Before i get into things I'm writing in C# using VS2003 with framework 1.1.

    I am having a problem accessing a user control in the code behind.

    I'm using the user control for some repetitive code and i need to access a public property.

    .aspx

    Code:
    <%@ Register TagPrefix="uc" TagName="Activity" Src="includes\inc_Activity.ascx" %>
    
    <uc:ACTIVITY id="Activity1" runat="server" src="blank.html"></uc:ACTIVITY>
    
    
    .aspx.cs
    
    public class client : System.Web.UI.Page
    {
    protected ACTIVITY Activity1;
    ...
    
    private void Page_Load(object sender, System.EventArgs e)
    {
    Activity1.sPage = "Client";
    ...
    
    
    .ascx.cs
    
    private string _sPage;
    public string sPage
    {
    get {
    return _sPage;
    }
    set {
    sPage = value;
    }
    }

    Error when compiling;

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


    Any help would be much appreciated!
  • kenobewan
    Recognized Expert Specialist
    • Dec 2006
    • 4871

    #2
    As a starter always stick to the same case, esp in c#.

    Comment

    Working...