Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Building Controls / April 2006

Tip: Looking for answers? Try searching our database.

Default toolbox tab for custom control?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Arthur Dent - 07 Apr 2006 02:57 GMT
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.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.