This documentation is archived and is not being maintained.

Web Page Controls (How Do I in Visual Web Developer)

This page links to help on widely used tasks for working with ASP.NET Web server controls. To view other categories of popular tasks covered in Help, see How Do I in Visual Web Developer.

The information in this topic is subdivided into the following sections:

Walkthrough: Displaying and Tracking Advertisements with the AdRotator Control

Provides a tutorial on using the AdRotator control to display randomly selected advertisements that you create.

Walkthrough: Creating a Web Site with Membership and User Login

Provides a tutorial on using login controls to add a login page, authentication, and authorization.

Walkthrough: Displaying a Menu on Web Pages

Provides a tutorial on using the Menu control.

Walkthrough: Controlling ASP.NET Menus Programmatically

Provides a tutorial on working with the Menu control in code.

Walkthrough: Adding Site Navigation to a Web Site

Provides a tutorial on using navigation controls to create ways for users to move between pages in your Web site.

Walkthrough: Creating Reusable Elements with ASP.NET User Controls

Provides a tutorial on using the Visual Web Developer designer to create a composite control that you can add to any ASP.NET Web page.

Walkthrough: Validating User Input in a Web Forms Page

Provides a tutorial on using the validator controls to check user input.

Walkthrough: Creating a Web Parts Page

Provides a tutorial on using Web Parts controls to create ASP.NET Web pages that users can customize in a browser.

Walkthrough: Creating a Basic ASP.NET Wizard Control

Provides a tutorial on using the Wizard control.

Walkthrough: Advanced Use of the ASP.NET Wizard Control

Provides a tutorial on programmatically controlling the Wizard control.

Walkthrough: Displaying an XML Document in a Web Forms Page Using Transformations

Provides a tutorial on using the Xml control to display the contents of an XML document on a page.

Walkthrough: Creating an Accessible Web Application

Provides a tutorial on configuring Web server controls to create an ASP.NET Web page that can be accessed by people with disabilities, including how to test accessibility.

Data (How Do I in Visual Web Developer)

Provides links to topics that describe how to use data controls to display and edit data on an ASP.NET Web page.

How to: Add Web Server Controls to a Web Forms Page Using the Web Forms Designer

Provides steps for how to use designer features to create and edit Web server controls.

How to: Add Server Controls to an ASP.NET Web Page Using ASP.NET Syntax

Provides steps for adding controls to a page by editing the markup directly.

Adding HTML Server Controls to an ASP.NET Web Page

Provides information about working with programmable HTML elements in the Visual Web Developer designer.

How to: Add HTML Server Controls to a Web Page Using ASP.NET Syntax

Provides steps for creating programmable HTML elements by editing the markup directly.

How to: Convert HTML Server Controls to HTML Elements

Provides steps for treating HTML elements as Web server controls.

How to: Specify Whether ASP.NET Web Server Controls Post to the Server

Provides steps for how to configure a control to cause the page to post back immediately when users select a value.

How to: Set ASP.NET Server Control Properties

Provides steps for how to use the Visual Web Developer designer to set control properties.

How to: Set Web Server Control Properties Based on Simple Values or Enumerations

Provides steps for how to set properties with text or integer values, or to one of a set of predefined values.

How to: Set Web Server Control Properties in Collections

Provides steps for how to set properties that contain multiple individual elements.

How to: Set Web Server Control Unit Properties

Provides steps for how to set sizes (such as height or width).

How to: Set Web Server Control Color Properties

Provides steps for how to set foreground and background colors.

How to: Set HTML Attributes for Controls in ASP.NET Web Pages

Provides steps for how to add HTML (or other markup) attributes to Web server controls, both declaratively and programmatically.

How to: Set ASP.NET Server Control Style Properties Using ASP.NET Syntax

Provides steps for setting control properties by editing the markup directly.

How to: Set ASP.NET Server Control Style Properties in the Designer

Provides steps for using the Visual Web Developer designer to set individual style properties.

How to: Use Resources to Set Property Values in Web Server Controls

Provides steps for how to configure controls to read property values from resource (.resx) files to dynamically display pages in different languages.

How to: Set Access Keys for ASP.NET Web Server Controls

Provides steps for how to configure controls so that users can jump to them using ALT-key combinations.

How to: Create Event Handlers in ASP.NET Web Pages

Provides steps for writing code that responds to events in the page and in controls, using the Visual Web Developer designer.

How to: Connect Multiple Events to a Single Event Handler in ASP.NET Web Pages

Provides steps for writing code that can respond to events from different controls, using the Visual Web Developer designer.

How to: Determine which Web Server Control Raised an Event

Provides steps for using event information to determine the source of an event.

How to: Read HTML Attributes for Controls in Web Forms Pages

Provides steps for reading attributes from control markup that are not exposed as properties.

How to: Set Focus on ASP.NET Web Server Controls

Provides steps for setting the focus on a control when the page runs.

How to: Respond to Button Web Server Control Events in Client Script

Provides steps for adding a client-script event handler to an ASP.NET Web server button control.

How to: Set ASP.NET Server Control Style Properties Programmatically

Provides steps for using code to work with style properties of a control.

How to: Set HTML Server Control Properties Programmatically

Provides steps for using code to set attributes of HTML elements.

How to: Add Controls to an ASP.NET Web Page Programmatically

Provides steps for using code to create control instances and add them to the page.

How to: Locate the Web Forms Controls on a Page by Walking the Controls Collection

Provides steps for using code to find a specific control on a page.

How to: Access Members of a Web Server Control's Naming Container

Provides steps for using code to find a specific control on a page.

How to: Locate Controls by ID in an ASP.NET Web Page

Provides steps for using code to find a specific control on a page.

How to: Display Ads From an XML File Using the AdRotator Web Server Control

Provides steps for displaying advertisement information from an XML file in the AdRotator control.

How to: Display Ads From a Database Using the AdRotator Web Server Control

Provides steps for displaying advertisement information from a database in the AdRotator control.

How to: Select Ads in an AdRotator Web Server Control Programmatically

Provides steps for displaying specific ads in the AdRotator control.

How to: Add BulletedList Web Server Controls to a Web Forms Page

Provides steps for creating a BulletedList control using the Visual Web Developer designer.

How to: Respond to User Clicks in BulletedList Web Server Controls

Provides steps for running code when users select an item in a BulletedList control.

How to: Add Button Web Server Controls to a Web Forms Page

Provides steps for creating Button, LinkButton, and ImageButton controls using the Visual Web Developer designer.

How to: Respond to Button Web Server Control Events

Provides steps for running code when users click a Button, LinkButton, or ImageButton control.

How to: Determine Coordinates in an ImageButton Web Server Control

Provides steps for reading the x and y coordinates of where a user clicked in an ImageButton control.

How to: Customize Calendar Web Server Control Appearance

Provides steps for changing the default look of the Calendar control.

How to: Customize Individual Days in a Calendar Web Server Control

Provides steps for changing the default look of days in the Calendar control.

How to: Format Calendar Web Server Control Elements Using Styles

Provides steps for setting the look of days, weeks, months, weekends and other elements in a Calendar control.

How to: Control User Date Selection in a Calendar Web Server Control

Provides steps for enabling users to select single dates, weeks, or months in a Calendar control.

How to: Control Month Navigation in a Calendar Web Server Control

Provides steps for enabling users to navigate from month to month using a Calendar control.

How to: Respond to Date Selection in a Calendar Web Server Control

Provides steps for running code when users select a date in the Calendar control.

How to: Read Selected Dates in the Calendar Web Server Control

Provides steps for reading the user's selection in a Calendar control.

How to: Set Today's Date Programmatically in a Calendar Web Server Control

Provides steps for setting the current date in a Calendar control.

How to: Select Dates Programmatically in a Calendar Web Server Control

Provides steps for making a date selection in code in a Calendar control.

How to: Display Selected Dates from a Database in the Calendar Control

Provides steps for reading dates from a database and displaying them in a Calendar control.

How to: Add CheckBox Web Server Controls to a Web Forms Page

Provides steps for creating a CheckBox control using the Visual Web Developer designer.

How to: Get and Set a CheckBox Web Server Control Value Programmatically

Provides steps for reading and writing the selection in a CheckBox control.

How to: Add CheckBoxList Web Server Controls to a Web Forms Page

Provides steps for creating a CheckBoxList control using the Visual Web Developer designer. You can use this control to display true/false choices from a database or other source.

How to: Set Layout in a CheckBoxList Web Server Control

Provides steps for specifying whether a CheckBoxList control is displayed in rows or columns.

How to: Respond to User Selection in a CheckBox Web Server Control

Provides steps for running code when users select an item in a CheckBoxList control.

How to: Set Layout in a RadioButtonList Web Server Control

Provides steps for specifying whether a CheckBoxList control is displayed in rows or columns.

How to: Add DropDownList Web Server Controls to a Web Forms Page

Provides steps for creating a DropDownList control using the Visual Web Developer designer.

How to: Upload Files with the FileUpload Web Server Control

Provides steps for creating a FileUpload control using the Visual Web Developer designer. This control enables users to send files to the server from their computer.

How to: Add HyperLink Web Server Controls to a Web Forms Page

Provides steps for creating a Hyperlink control using the Visual Web Developer designer.

How to: Add Image Web Server Controls to a Web Forms Page

Provides steps for creating an Image control using the Visual Web Developer designer.

How to: Add ImageButton Web Server Controls to a Web Forms Page

Provides steps for creating an ImageButton control using the Visual Web Developer designer.

How to: Add ImageMap Web Server Controls to a Web Page

Provides steps for creating an ImageMap control using the Visual Web Developer designer.

How to: Respond to User Clicks in ImageMap Web Server Controls

Provides steps for running code when users click a hot spot in an ImageMap control.

How to: Add Label Web Server Controls to a Web Forms Page

Provides steps for creating a Label control using the Visual Web Developer designer.

How to: Use Label Web Server Controls as Captions

Provides steps for associating a Label control with another control and using it as a caption with an optional shortcut key.

How to: Add ListBox Web Server Controls to a Web Forms Page

Provides steps for creating a ListBox control using the Visual Web Developer designer.

How to: Add Literal Web Server Controls to a Web Forms Page

Provides steps for creating a Literal control using the Visual Web Developer designer. This is a way to add static text to the page in code.

How to: Add MultiView Web Server Controls to a Web Forms Page

Provides steps for creating MultiView and View controls using the Visual Web Developer designer.

How to: Add Panel Controls to a Web Forms Page

Provides steps for creating a Panel control using the Visual Web Developer designer. You can use this control as the container for other controls.

How to: Add PlaceHolder Web Server Controls to a Web Forms Page

Provides steps for creating a Placeholder control using the Visual Web Developer designer. You can use this control as the container for other controls.

How to: Add RadioButton Web Server Controls to a Web Forms Page

Provides steps for creating a RadioButton control using the Visual Web Developer designer.

How to: Respond to a User Selection in a RadioButton Web Server Control Group

Provides steps for running code when users click a RadioButton control.

How to: Set and Get the Selection in a RadioButton Web Server Control

Provides steps for reading and writing the selection in a RadioButton control, whether singly or in a group.

How to: Add RadioButtonList Web Server Controls to a Web Forms Page

Provides steps for creating a RadioButtonList control using the Visual Web Developer designer. You can use this control to display mutually exclusive choices from a database or other source.

How to: Add Table Web Server Controls to a Web Forms Page

Provides steps for creating a Table control, which enables you to manage tables on the page in code.

How to: Add Rows and Cells Dynamically to a Table Web Server Control

Provides steps for using code to create rows and cells in a Table control.

How to: Set a TextBox Web Server Control for Password Entry

Provides steps for configuring a TextBox control to display text as stars or dots.

How to: Specify Multiline Input for a TextBox Web Server Control

Provides steps for configuring a TextBox control to enable users to enter more than one line of text.

How to: Get and Set Values in TextBox Web Server Controls

Provides steps for reading and writing the value in a TextBox control.

How to: Respond to Changes in a TextBox Web Server Control

Provides steps for running code when users change text in a TextBox control.

How to: Add XML Web Server Controls to a Web Forms Page

Provides steps for creating an Xml control using the Visual Web Developer designer. This control enables you to display an XML document on the page.

How to: Load XML Data in the XML Web Server Control

Provides steps for configuring an Xml control to display an XML document or XML stream.

How to: Transform XML Data in the XML Web Server Control

Provides steps for using a transformation with the Xml control to customize the display of XML data.

How to: Add Items in List Web Server Controls

Provides steps for adding elements to a BulletedList, CheckBoxList, DropDownList, ListBox, or RadioButtonList control using the Visual Web Developer designer.

How to: Set the Selection in List Web Server Controls

Provides steps for specifying the current item in a CheckBoxList, DropDownList, ListBox, or RadioButtonList control.

How to: Determine the Selection in List Web Server Controls

Provides steps for using code to read the current element in a CheckBoxList, DropDownList, ListBox, or RadioButtonList control.

How to: Respond to Changes in List Web Server Controls

Provides steps for running code when users select an item in a CheckBoxList, DropDownList, ListBox, or RadioButtonList control.

How to: Populate List Web Server Controls from a Data Source

Provides steps for binding the BulletedList, CheckBoxList, DropDownList, ListBox, or RadioButtonList control to data in a database.

How to: Add DataList Web Server Controls to an ASP.NET Web Page

Provides steps for creating a DataList control, which enables you to display data in an HTML table using a layout you define.

Walkthrough: Displaying and Formatting Data with the DataList Web Server Control

Provides a tutorial on creating a DataList control, which enables you to display data in an HTML table using a layout you define.

How to: Allow Users to Delete Items in DataList Web Server Controls

Provides steps on configuring the DataList control to enable users to delete data records.

How to: Allow Users to Edit Items in DataList Web Server Controls

Provides steps on configuring the DataList control to enable users to edit data records.

How to: Allow Users to Select Items in DataList Web Server Controls

Provides steps on configuring the DataList control to enable users to select (highlight) a specific item.

How to: Customize Items Dynamically in the DataList Web Server Control

Provides steps for how to use code to change the look or behavior of items in a DataList control at run time.

How to: Specify Flow or Table Format in DataList Web Server Controls

Provides steps for how to set the layout of a DataList control.

How to: Specify Horizontal or Vertical Layout in DataList Web Server Controls

Provides steps for how to set the layout of a DataList control.

Walkthrough: Editing and Inserting Data in Web Pages with the DetailsView Web Server Control

Provides a tutorial on using a DetailsView control to enable users to edit existing records and create new ones.

Modifying Data Using a DetailsView Web Server Control

Provides information on using the DetailsView control to enable users to edit data one record at a time.

Paging in a DetailsView Web Server Control

Provides information on configuring the DetailsView control to enable users to page through multiple records, one at a time.

Walkthrough: Displaying Formatted Data in Web Pages with the FormView Web Server Control

Provides a tutorial on using a FormView control to display a single record at a time, using free-form layout templates that you define.

Modifying Data Using a FormView Web Server Control

Provides steps on using a FormView control to enable users to edit data one record at a time.

Paging in a FormView Web Server Control

Provides information on configuring the FormView control to enable users to page through multiple records, one at a time.

Walkthrough: Basic Data Access in Web Pages

Provides a tutorial on how to use the GridView control and SqlDataSource controls to display data on an ASP.NET Web page.

Walkthrough: Creating a Web Page to Display Access Database Data

Provides a tutorial on how to use the GridView control and AccessDataSource controls to display data from a Microsoft Access database on an ASP.NET Web page.

Walkthrough: Creating Master/Detail Web Pages in Visual Studio

Provides a tutorial on how to use the DropDownList, GridView, DetailsView, and SqlDataSource controls to create pages that display lists of data where the user can select an individual record to examine further.

Walkthrough: Simple Sorting for the GridView Web Server Control

Provides a tutorial on how to use built-in features of the GridView control to enable users to sort the displayed data.

How to: Customize Controls for Editing in the GridView Web Server Control

Provides steps on configuring the GridView control to display the controls that you choose when in edit mode.

How to: Set GridView Web Server Control Column Width Dynamically

Provides steps for how to set column widths in the GridView according to the width of the data being displayed.

How to: Respond to Button Events in Data-Bound Controls

Provides steps for how to handle events raised by button controls in list data controls such as the GridView, DataList, and Repeater controls.

How to: Enable Default Deleting in the GridView Web Server Control

Provides steps on configuring the GridView control to enable users to delete data records.

How to: Enable Default Editing in the GridView Web Server Control

Provides steps on configuring the GridView control to enable users to edit data records.

How to: Enable Default Paging in the GridView Web Server Control

Provides steps on configuring the GridView control to enable users to page through long lists of data records.

Walkthrough: Data Binding to a Custom Business Object

Provides a tutorial on how to use the ObjectDataSource control to create multi-tier data access in an ASP.NET Web application.

Walkthrough: Data Binding Web Pages with a Visual Studio Data Component

Provides a tutorial on how to use Visual Studio tools to create a data-access object that you can use with the ObjectDataSource control.

How to: Add Repeater Web Server Controls to a Web Forms Page

Provides steps for creating a Repeater control, which enables you to display data on an ASP.NET Web page using free-form layout templates that you define.

How to: Respond to Button Events in DataList or Repeater Items

Provides steps for how to handle events raised by button controls in list data controls such as the GridView, DataList, and Repeater controls.

Walkthrough: Displaying Hierarchical Data in a TreeView Control

Provides a tutorial on using the TreeView control to display XML data.

How to: Create ASP.NET Web Control Templates Declaratively

Provides steps for creating templates in the GridView, DetailsView, FormView, DataList, and Repeater controls by editing the markup directly.

How to: Bind to Data in a Templated Control

Provides steps on adding data-bound controls to templates in controls such as the GridView, DetailsView, FormView, DataList, and Repeater controls.

How To: Create ASP.NET Web Server Control Templates Dynamically

Provides steps for creating templates in the GridView, DetailsView, FormView, DataList, and Repeater controls in code.

Walkthrough: Creating a Web Site with Membership and User Login

Provides a tutorial on using login controls to add a login page, authentication, and authorization.

How to: Add a LoginStatus Button to an ASP.NET Web Page

Provides steps for adding a link to pages that helps users log in and out of your Web application.

How to: Use Advanced Features of the ASP.NET Login Control

Provides steps for changing the default appearance of the Login control.

How to: Customize the PasswordRecovery Control

Provides steps for changing the default appearance of the PasswordRecovery control.

How to: Create an ASP.NET Login Page

Provides steps for creating an ASP.NET Web page that uses the Login control to authenticate users through ASP.NET membership.

How to: Enable User Registration

Provides steps for enabling users to register on your Web site using the CreateUserWizard control and ASP.NET membership.

How to: Enable User Password Recovery Using the ASP.NET PasswordRecovery Control

Provides steps for using the PasswordRecovery control to enable users to have a new or recovered password e-mailed to them.

How to: Use Advanced Features of the ASP.NET Login Control

Provides steps for customizing the behavior of the Login control.

How to: Display the Name of the Current User

Provides steps for using the LoginName control to display the user's logged-in name (or a login link).

How to: Display Different Information to Anonymous and Logged In Users

Provides steps for using the LoginView control to create one display for logged-in users and a different one for users who are not yet logged in.

How to: Display Site-Map Data in Non-Hierarchical Web Server Controls

Provides steps for using a control such as a DropDownList control to work with site map data.

Walkthrough: Controlling ASP.NET Menus Programmatically

Provides a tutorial on how to work with the Menu control in code.

How to: Customize the Appearance of SiteMapPath Web Server Controls

Provides steps for changing the default appearance of the SiteMapPath control.

How to: Filter the Nodes Retrieved by SiteMapDataSource Web Server Controls

Provides steps for programmatically determining what site map information to display to users.

How to: Add or Delete TreeView Node Elements

Provides steps for populating a TreeView control with static nodes.

How to: Customize the ASP.NET CreateUserWizard Control

Provides steps for changing the default appearance of a Wizard control.

How to: Create ASP.NET User Controls

Provides steps on using the Visual Web Developer designer to create a composite control that you can add to any ASP.NET Web page.

How to: Convert Web Forms Pages into ASP.NET User Controls

Provides steps on configuring an existing ASP.NET Web page to be a user control.

How to: Include ASP.NET User Controls in Web Pages

Provides steps on adding a user control to an ASP.NET Web page in the Visual Web Developer designer.

How to: Create Instances of ASP.NET User Controls Programmatically

Provides steps on programmatically creating user controls and adding them to an ASP.NET Web page.

How to: Validate Required Entries for ASP.NET Server Controls

Provides steps for preventing users from skipping a field in a page.

How to: Validate Against a Specific Value for ASP.NET Server Controls

Provides steps for requiring users to enter one of a specific set of values.

How to: Validate Against a Data Type for ASP.NET Server Controls

Provides steps for requiring users to enter a value that is an integer, date, or other type.

How to: Validate Against Patterns for ASP.NET Server Controls

Provides steps for requiring users to enter a value that matches a certain pattern, such as a phone number or e-mail address.

How to: Validate Against a Range of Values for ASP.NET Server Controls

Provides steps for requiring users to enter a value that is between a minimum and maximum value (numbers or text).

How to: Validate Against Values in a Database for ASP.NET Server Controls

Provides steps for using custom logic to look up values in a database to check a user's entry.

How to: Disable Validation for ASP.NET Server Controls

Provides steps for conditionally turning off validation.

How to: Validate with a Custom Function for ASP.NET Server Controls

Provides steps for creating your own logic for validating user entries.

How to: Test Validity Programmatically for ASP.NET Server Controls

Provides steps for determining in code whether validation checks have passed or failed.

How to: Validate Programmatically for ASP.NET Server Controls

Provides steps for using code to trigger the check for one or more validation controls.

How to: Display Server Side Custom Validation Messages for ASP.NET Server Controls

Provides steps for changing the appearance and text for validation errors.

How to: Control Validation Error Message Display for ASP.NET Server Controls

Provides steps for configuring validation controls to specify how and where error messages appear.

How to: Format Validation Error Messages for ASP.NET Server Controls

Provides steps for using HTML and properties to customize the look of validation error messages.

How to: Specify Layout for In-Place Messages On ASP.NET Server Controls

Provides steps for specifying whether validation controls take up space on the page when not displaying an error message.

Web Parts Control Set Overview

Provides information on different pieces you can use to create customizable ASP.NET Web pages.

Walkthrough: Creating a Web Parts Page

Provides a tutorial on using Web Parts controls to create ASP.NET Web pages that users can customize in a browser.

Web Parts Personalization Overview

Provides information on tracking customizations for individual users.

Walkthrough: Implementing Web Parts Personalization with a User Control

Provides a tutorial on how to create an ASP.NET user control (rather than a custom control) to track user-specific information.

Walkthrough: Changing Display Modes on a Web Parts Page

Provides a tutorial on how to create a page where users can switch between display and edit modes to customize the page.

How to: Treat a User Control as a Web Parts Control

Provides steps for how to create an ASP.NET user control (rather than a custom control) to track user-specific information.

How to: Declare a Static Connection between Two Web Parts Controls

Provides steps for creating a static link between Web Parts controls declaratively.

How to: Enable Shared Personalization of Web Parts Pages

Provides steps for configuring Web Parts personalization so that user information is available to other users.

Show: