R – Custom Server Control that can be dragged into design view in Visual Studio

asp.netcustom-server-controlsvisual-studio-2008

How do I setup a custom server control, so that it can be dragged into a design view in Visual Studio?

I have create a separate ASP.NET Server Control project and a custom MailLink control, basically by copying the code from this MSDN article: How to: Use Custom ASP.NET Server Controls in Visual Studio. The control works fine, if I manually register the library and insert the control in my web page with these two lines:

<%@ Register Namespace="Samples.AspNet" TagPrefix="Sample" %>
<Sample:MailLink runat="server" />

But how do I register / configure the control, so that it can be dragged into a design view i Visual Studio? If I drag my control from the solution explorer all I get is the path to the control. If add the dll from the server control project to my VS toolbox I get a clipboard FORMATETC error when I drag the control onto the design view.

Best Answer

Here's a how to that I found more useful than the MSDN one.

http://www.osnews.com/story/6802/Visual_Studio_NET_Design_View_and_Custom_Web_Controls