Previous Page
Next Page

Chapter 4 Quick Reference


Do This

Create a custom control that takes over the rendering process

Derive a class from System.Web.UI.Control

Override the Render method

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

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


Browse to the assembly containing the control

Change the properties of controls on a page

Make sure the page editor is in Designer mode

Highlight the control whose property you want to change

Select the property to edit in the property window

Store view state information that lives beyond the scope of the page

Use the ViewState property of the control

It's a name/value dictionary that contains serializable types

Just be sure to use the same index to retrieve the information as you do to store the information

Write browser version-independent rendering code

Use the HtmlTextWriter tag-rendering methods for specific tags instead of hard-coding them. The Render method will have the correct HtmlTextWriter based on header information coming down from the browser.

Previous Page
Next Page