Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to define default "TagPrefix" for custom controls

Tags:

asp.net

I have a number of custom controls that I am trying to enable designer support for. The signature looks something like the following:

[ToolboxData("<{0}:MyDropDownList runat=\"server\" CustomProp="123"></{0}:MyDropDownList>")]
public class MyDropDownList: DropDownList
{
   ... code here
}

This works fine, but when I drag a control onto the page from the toolbox, the TagPrefix that gets added is "cc1":

<%@ Register Assembly="DBMClientPortal.Controls" Namespace="DBMClientPortal.Controls"
    TagPrefix="cc1" %>

Obviously it is somewhat irrelevant what that TagPrefix is... it works as it stands, but I figured I must be able to change it somehow and curiosity got the better of me...

Anyone know how to define what the TagPrefix will be set to when dragging a custom control onto a page in visual studio?

Thanks, Max

like image 788
Max Schilling Avatar asked Oct 24 '08 13:10

Max Schilling


1 Answers

It looks something like this:

[assembly:TagPrefix("MyControls","RequiredTextBox")]

and here's some more info about it.

like image 175
DOK Avatar answered Sep 30 '22 02:09

DOK