.NET Samples - ASP.NET Server Controls Introduction

This section includes the following samples:

Controls6 Sample

Controls5 Sample

Controls4 Sample

Controls3 Sample

Controls1 Sample

Controls2 Sample

Controls6 Sample

This sample demonstrates how to use the Page.Navigate method to pass parameters to another target page. It also demonstrates how to easily get access to these parameters from the target page.

Namespaces used in this sample:

System.Web; System

Classes used in this sample:

Page; Message; Object; Label; EventArgs; Control; HttpUtility; Url

Controls5 Sample

This sample demonstrates how to use the <asp:hyperlink runat=server> control to navigate to another page (passing custom query string parameters along the way). Page navigation among multiple pages is a common scenario in virtually all Web applications.

Namespaces used in this sample:

System.Web; System

Classes used in this sample:

Page; Url; Label; Random; Object; EventArgs; HttpUtility

Controls4 Sample

This sample demonstrates how to attach and handle four button events on a single page using event handlers. Event handlers provide a clean way for page developers to structure logic within an ASP.NET page.

Namespaces used in this sample:

(none)

Classes used in this sample:

Font; ListItem; Object; EventArgs; Control

Controls3 Sample

This sample shows how ASP.NET server controls can optionally expose and raise server events, which can be handled by page developers. This sample demonstrates how to attach an OnClick event to a button control.

Namespaces used in this sample:

(none)

Classes used in this sample:

Message; Control; Object; EventArgs

Controls1 Sample

This sample declares three <asp:label runat="server"> server controls and customizes the text and style properties of each one individually. ASP.NET server controls are identified within a page using declarative tags that contain a runat="server" attribute.

Namespaces used in this sample:

(none)

Classes used in this sample:

Message; Page; Control

Controls2 Sample

This sample demonstrates how a page developer can programmatically set an <asp:label runat="server"> control's Text property within the Page_Load event.

Namespaces used in this sample:

(none)

Classes used in this sample:

Message; Page; Control; Object; EventArgs