Microsoft ASP.NET 2.0 Step By Step (Step By Step (Microsoft))

Chapter 5 Quick Reference

To

Do This

Create a custom control composed of other server-side controls that lives in its own assembly

Derive a class from System.Web.UI.Control

Override the CreateChildControls method

Visual Studio includes a project type, Web Custom Control, that fits the bill

Add controls to a custom composite control

Instantiate the child control

Add the child control to the composite control's Control collection

Add a custom control to the toolbox

Show the toolbox if it's not already showing by selecting View | Toolbox from the main menu

Right mouse click anywhere in the toolbox

Select Choose Items from the local menu

Choose a control from the list

OR

Browse to the assembly containing the control

Tell ASP.NET to make up unique IDs for the child controls within the composite control

Add INamingContainer to the control's inheritance list

Raise events within a custom composite control

Expose the events using the event keyword

Create composite controls with designer support

Within a Visual Studio Web Site project, select Web site | Add New Item… from the main menu

Select the Web User Control template

Категории