I'm trying to create my own drop down list to use on a web page and I just can't get it to work the way I need want.
In it's most basic form I can create a class, inherit from System.Web.UI.WebControls.DropDownList, register it on the page, add the markup and it will at least show a control on the page:
My Class:
Imports System
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Text
Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.WebControls
Namespace CustomDropdown
<DefaultProperty("Text"), ToolboxData("<{0}:DropDownListWithAttributes runat=server></{0}:DropDownListWithAttributes>")>
Public Class DropDownListWithAttributes
Inherits System.Web.UI.WebControls.DropDownList
End Class
End Namespace
Page Register:
<%@ Register TagPrefix="myControls" Namespace="CustomDropdown" %>
Markup:
<myControls:DropDownListWithAttributes ID="ddlMyTestCustomDDL" runat="server"></myControls:DropDownListWithAttributes>
But that's it. That's as far as I can get. I cannot access it from code behind at all. It's like it doesn't exist. I need to be able to fill it with items, trigger events, etc... All the things a normal drop down list would be able to do.
The markup seems to think it can have events:

But when I add one the designer breaks:

So I do not get normal ddl functionality, I'm unable to access the control from code behind, adding any kind of event breaks stuff...I'm at a loss on how to make this work :(

Well, with Andrew's suggestion and moving it to it's own project, it seems to be working now. Here's what it looks like:
C# Class Library: DropDownWithAttributes with a single .cs file: DropDownListWithAttributes.cs
I added the project to my solution and added a reference to DropDownWithAttributes from my web project:
Registered on my page:
Added the control on the page:
That's where things broke before....it's looking better now: