You have developed a custom control named ProductsGrid and a custom control named DropDownGrid that will be used in the redevelopment of Domain.com’s e-Commerce Web application. Both customs control are contained in an assembly named ck_controls.dll. You need to add the two custom controls to the Visual Studio toolbox. However, when you attempt to add the custom controls to the Visual Studio toolbox, you can select the assembly that contains in the Choose Toolbox Item dialog box, only the DropDownGrid control appears in the select list. You need to add an attribute to the ProductsGrid control’s class definition to that it is listed in the Choose Toolbox Item dialog box.
What code segment should you use?
A.
<ToolboxBitmap(GetType(ProductsGrid))>
B.
<ToolboxItem(true)>
C.
<ToolboxItemFilter("")>
D.
<ToolboxData("<{0}:ProductsGrid></{0}:ProductsGrid>")>
Explanation:
The ToolboxItem attribute specifies whether the control should be visible or not. When it is set to True, the control is visible.
Incorrect Answers:
A: The TooboxBitmap attribute specifies the bitmap image that should be used as the icon for the control. It will not ensure that the control can be added to the Visual Studio Toolbox.
C: The ToolboxItemFilter attribute specifies the filter Visual Studio should use to determine whether the control should be enabled or disabled for a specific designer. It will not ensure that the control can be added to the Visual Studio Toolbox.
D: The ToolboxData attribute specifies the markup that should be created on the page when the control is added to a page. It will not ensure that the control can be added to the Visual Studio Toolbox.