I have an ASP.net control that inherits from `UserControl`:

**File 1**:

```
public partial class Controls_AllocationDuplicate : System.Web.UI.UserControl

```

**File 2**:

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

```

[I need the control to inherit from `Control`, rather than `UserControl`](https://stackoverflow.com/questions/11658053/how-to-add-a-templating-to-a-usercontrol):

**File.aspx.cs** *(changed)*:

```
public partial class Controls_AllocationDuplicate : System.Web.UI.Control

```

**File.aspx** *(not changed)*:

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

```

When i do this, Visual Studio gives a compile error:

> 
> 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).**
> 
> 
> 

How can I have my *control* inherit from `Control` rather than `UserControl`?

Series
------

This question is one in the ongoing Stackoverflow series, **"Templating user controls"**:

* [How to add a Templating to a UserControl?](https://stackoverflow.com/questions/11658053/how-to-add-a-templating-to-a-usercontrol/11700540)
* [How to inherit from Control, rather than UserControl?](https://stackoverflow.com/questions/12323303/how-to-inherit-from-control-rather-than-usercontrol)
* [UserControl has IsPostBack, but Control does not](https://stackoverflow.com/questions/12321621/usercontrol-has-ispostback-but-control-does-not/12321692)
* [UserControl does not have public property named ContentTemplate](https://stackoverflow.com/questions/11656637/usercontrol-does-not-have-public-property-named-contenttemplate)
* [How do i specify CodeFileBaseClass from web.config?](https://stackoverflow.com/questions/12325192/how-do-i-specify-codefilebaseclass-from-web-config)