Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7166721
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T14:27:33+00:00 2026-05-28T14:27:33+00:00

I want to create a user control DerivedUserControl.ascx that derives form another user control

  • 0

I want to create a user control DerivedUserControl.ascx that derives form another user control BaseUserControl.ascx. The base user control derives from System.Web.UI.UserControl as required. These user controls are defined in different folders. Because I’m using a Visual Studio 2010 Web Site project (I’m not able to switch to Web Application project), these user controls are not defined inside a namespace.

My problem is that when I try to compile the project the base class of the derived user control cannot be resolved (obviously because the compiler doesn’t know what .ascx file defines the base class). Is there a way resolve this issue?

I tried everything I could imagine, without success. Any help would be greatly appreciated.

BaseUserControl.ascx

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="BaseUserControl.ascx.cs" Inherits="BaseUserControl" %>

BaseUserControl.ascx.cs

public partial class BaseUserControl : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
}

DerivedUserControl.ascx

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="DerivedUserControl.ascx.cs" Inherits="DerivedUserControl"  %>

DerivedUserControl.ascx.cs

public partial class DerivedUserControl : BaseUserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
}

Error

The type or namespace name 'BaseUserControl' could not be found
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T14:27:34+00:00Added an answer on May 28, 2026 at 2:27 pm

    When using ASP.NET Web Site (as apposed to a Web Project) you need to add <@Reference> element to your DerivedUserControl.ascx.

    From MSDN it…

    Indicates that another user control, page source file, or arbitrary
    file located at some virtual path should be dynamically compiled and
    linked against the current ASP.NET file (Web page, user control, or
    master page) in which this directive is declared.

    <%@ Reference VirtualPath="~/FolderName1/BaseUserControl.ascx" %>

    Once you’ve done that you can reference it like so

    public partial class DerivedUserControl : ASP.foldername1.baseusercontrol_ascx
    

    Where FolderName1 is the folder your BaseUserControl is in.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

ASP.Net 3.5 I want to create a user control that contains the ListView and
I want to create a program that requests from the user 10 grades and
I want a create a custom/user control that has children. For Example, I want
Like Asp.Net applications where we create User control(ASCX), and declare some properties for that
I want to create a user control that will again contain a user control
I want to create in C# Visual Studio 2010 my user control from standard
I have just started to create a user control realising that I want a
I want to create a ASP.NET user control from an XML using XSLT. Currently
I have a user control and I want to create a property of type
I am trying to create a winForms user control. But I want would like

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.