您添加了
TagPrefix attribute
去你的图书馆?
来自MSDN
[assembly:TagPrefix("CustomControls", "custom")]
namespace CustomControls
{
// Simple custom control
public class MyCS_Control : Control
你也应该看看
toolbox data attribute
namespace CustomControls
{
[ ToolboxData("<{0}:MyLabel Text='MyLabel' BorderColor='Yellow' BackColor='Magenta' BorderWidth = '10' runat='server'></{0}:MyLabel>") ]
public class MyLabel : Label
{
最后,在web.config中注册程序集
<system.web>
...
<pages>
...
<controls>
...
<add tagPrefix="yourPrefix"
namespace="MyAssembly.Some.Namespace"
assembly="MyAssembly" />
...
重新生成项目,然后将其中一个控件拖到页面上。