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.UserControlMake 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" %>
The error you received explains it correctly.
You should change your ‘in-front’ file such that the
Inheritsattribute takes into account the namespace in which the control class resides: