Reply to comment

Add a Composite Control to the Visual Studio Toolbox

When you create your own custom control or want to add a control from a DLL that contains one or more controls, to use the control by just dragging and dropping it onto an ASPX page is to add it to your Visual Studio Toolbox. The easiest way to do this is to open your "slide out" toolbox in Visual Studio. It should looks something like this:

You can either add the controls to an existing Tab here or you can create a new Tab. In this case, let's create a new Tab to hold our control. To create a new Tab, right-click in the white region below the list of tabs and choose Add Tab:



Enter a new name for the Tab you want to create and then click out of the edit box to apply the new name.

Right click inside of the new Tab you just created and select Choose Items... from the context menu.

Now you have to wait for one of the "slowest dialogs known to man" to actually open. (NOTE: it's slow because it is gathering a list of all your current controls installed on your system which can be large). Once the dialog opens, we want to browse to the DLL where our control that we want to add is placed. Click the browse button.

Find the DLL that has your control(s) in it and choose that DLL. Then click the Open button.

What's really useful here is that Visual Studio automatically interrogates this DLL, finds all the controls in the DLL and then auto-checks the controls off in the list. If you scroll through this long list of controls, you will see your control already added and checked so it is ready to be added to the toolbox. Click OK to add it.

Now you should see your new control in the toolbox, ready to be dragged onto the page and used.

Depending on your control library, there may be certain controls that require other configuration of the web.config file or registration beyond this process but most controls, if written in pure managed code, should work similar to this process with no problems.

Reply