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 8001629
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T16:08:22+00:00 2026-06-04T16:08:22+00:00

i have a UserControl in ASP.net: GrobSelector.ascx.cs : … public partial class GrobSelector :

  • 0

i have a UserControl in ASP.net:

GrobSelector.ascx.cs:

...
public partial class GrobSelector : System.Web.UI.UserControl
{
   ...

i want to wrap this class in a namespace:

GrobSelector.ascx.cs:

...
namespace GrobSelectorNamespace
{
   public partial class GrobSelector : System.Web.UI.UserControl
   {
      ...
   ...       
}

Except now code fails to compile:

public partial class GrobSelector : System.Web.UI.UserControl

Make sure that the class defined in this code file matches the ‘inherits’ attribute, and that it extends the correct base class (e.g. Page or UserControl).

What’s the correct way to put an ASP.net UserControl in a namespace?


Bonus Chatter

The code in-front file contains:

GrobSelector.ascx:

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

Bonus Reading

  • Putting a Web User Control (ascx) in a namespace?
  • namespace in asp.net usercontrol
  • Getting namespace name not found for ASP.net user control
  • 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-06-04T16:08:23+00:00Added an answer on June 4, 2026 at 4:08 pm

    The error you received explains it correctly.

    You should change your ‘in-front’ file such that the Inherits attribute takes into account the namespace in which the control class resides:

    <%@ Control Language="C#" AutoEventWireup="true" CodeFile="VacationSelector.ascx.cs" 
        Inherits="VacationSelectorNamespace.VacationSelector"  %>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an ASP.NET user control (.ascx file). In this user control I want
For example, i have this ImageViewer.ascx UserControl: <div class=ImageTumbnails> <asp:ListView ID=ImageList runat=server ItemPlaceholderID=ItemContainer> <LayoutTemplate>
I have an asp.net usercontrol (ascx) that inherits from an abstract class (that inherits
I have an ASP.Net UserControl that looks like this: <%@ Control Language=C# AutoEventWireup=true CodeBehind=WebUserControl1.ascx.cs
I have a partial view (UserControl) that implements a simple pager in my Asp.Net
I have asp.net usercontrol that is including some js script like this <script type=text/javascript
I have a for which is built within an ASP.net usercontrol. This form is
I have a web project in C#/asp.net. I have a UserControl with a GridView
I have a UserControl in my Asp.net project that has a public property. I
I have an ASP.NET web form that has a container usercontrol that hosts several

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.