Is there any attribute i can add to a custom control class, similar to
<ToolboxData()> which would allow me to set a default tab in the toolbox
whihc a control should be added to? Id like to make my controls so that they
automatically add themselves to a tab for my own controls, named after my
company for example.
Thanks in advance,
- Arthur Dent.
Alessandro Zifiglio - 15 Apr 2006 11:44 GMT
hi Arthur, you can use the WebControlToolboxItem for this : there is some
sample code in the following reference.
http://msdn2.microsoft.com/en-US/library/system.web.ui.design.controlpersister(V
S.80).aspx
Specifically you want to look at the designer class in the sample code and
how they implement the following :
// Create a Web control toolbox item for the type of the control
System.Web.UI.Design.WebControlToolboxItem item =
new
System.Web.UI.Design.WebControlToolboxItem(ctrl.GetType());
// Add the Web control toolbox item to the toolbox
IToolboxService toolService = (IToolboxService)
this.Component.Site.GetService(typeof(IToolboxService));
if (toolService != null)
toolService.AddToolboxItem(item);
else
throw new Exception("IToolboxService was not found.");
Have a good easter,
Alessandro Zifiglio
> Is there any attribute i can add to a custom control class, similar to
> <ToolboxData()> which would allow me to set a default tab in the toolbox
[quoted text clipped - 4 lines]
> Thanks in advance,
> - Arthur Dent.