Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

Code for Web Forms Controls

Visual Studio .NET 2003

This topic is designed to help you find code that demonstrates how to perform common programming tasks with Web Forms controls.

Note   For tasks that pertain to Web Forms pages generally, see Code for Web Applications.

The following categories are represented in the list below:

You can also find sample code for Web Forms controls in the following locations:

Adding Controls to a Page

Example of...

Adding Web server controls using HTML syntax

Adding HTML server controls using HTML syntax

Adding controls at run time (general)

Adding controls at run time (Placeholder Control)

Referencing controls on the page

Properties, Attributes, and Styles

Example of...

Setting properties using HTML syntax

Setting properties of Web server controls dynamically

Setting properties of HTML server controls dynamically

Adding HTML attributes to ASP.NET server controls

Applying CSS styles to controls

Validation

Example of...

Creating a Web Forms page with several controls on it

Validating user input against a database

Creating custom validation logic

Testing for valid input

Displaying custom error messages

Validating programmatically

Templates

Example of...

Creating templates using HTML syntax

Creating templates from a template definition file

Creating templates in code

Creating templated columns for a DataGrid control in code

AdRotator Control

Example of...

Specifying an ad programmatically

Tracking responses to an ad

Button Control

Example of...

Responding to a button click

Determining where the user clicked in an ImageButton control

Calendar Control

Example of...

Responding when the user selects a specific day or date range

Responding when the user changes months

Customizing the appearance of individual days

Format individual elements in the calendar

Setting the current date

Selecting specific dates

Selecting specific dates

CheckBox, RadioButton Controls

Example of...

Adding items at run time

Getting or setting the check box state

Getting or setting the radio button state

Responding when the user checks the checkbox

Responding when the user clicks a radiobutton

DataGrid Control

Example of...

Sorting the grid

Deleting items

Editing items

Selecting rows

Responding when the user clicks a button in a DataGrid control

Customizing grid entries at run time

Creating templated columns dynamically

Displaying items in pages

Creating templates from a template definition file

Creating templated columns for a DataGrid control in code

DataList, Repeater Controls

Example of...

Selecting items in a DataList control

Editing items in a DataList control

Deleting items in a DataList control

Responding when the user clicks a button in a DataList or Repeater control

Creating templates from a template definition file

Creating templates in code

Customizing items at run time

ListBox, DropDown, CheckBoxList, RadioButtonList Controls

Example of...

Adding items to the control

Data-binding the control

Responding when the user makes a selection

Setting the selection

Determining the current selection

Setting layout in a CheckBoxList or RadioButtonList control

Placeholder Control

Example of...

Adding child controls at run time

Table, TableRow, TableCell Controls

Example of...

Adding rows and cells at run time

Displaying database information in a table

TextBox Control

Example of...

Getting or setting text box values

Responding when the user changes text box values

Filtering HTML elements out of user input

Allowing only predetermined characters in user input

User Controls and Custom Controls

Example of...

Creating a simple user control (general)

Creating a simple user control (walkthrough)

Adding a user control to a Web Forms page

Creating a simple custom control

XML Control

Example of...

Displaying XML data using a transformation

Loading XML data into the control

Applying transformations

Related Code Examples

Code for Data Access

Code Examples for Visual Basic Programmers

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft