.NET Samples - ASP.NET Web Forms Introduction
This section includes the following samples:
Intro1 Sample
Intro7 Sample
Intro13 Sample
Intro10 Sample
Intro12 Sample
Intro11 Sample
Intro9 Sample
Intro8 Sample
Intro6 Sample
Intro2 Sample
Intro4 Sample
Intro5 Sample
Intro3 Sample
Intro1 Sample
This sample demonstrates the simplest possible ASP.NET page, renaming the .html extension in a basic HTML file to .aspx.
Link to the online sample documentation
Link to the online sample source code
Namespaces used in this sample:
(none)
Classes used in this sample:
(none)
Intro7 Sample
This sample shows a simple custom-written calendar control, imported into an ASP.NET page using the Register directive.
Link to the online sample documentation
Link to the online sample source code
Namespaces used in this sample:
System; System.Web; System.Collections; System.Collections.Specialized; System.Web.UI
Classes used in this sample:
String; Page; Calendar; Array; TextWriter; Object; HtmlTextWriter; EventArgs; Message; Convert; File; Control; Header; Assembly; EventHandler; NameValueCollection
Intro13 Sample
This sample demonstrates the use of the code-behind method of writing ASP.NET page code.
Link to the online sample documentation
Link to the online sample source code
Namespaces used in this sample:
System; System.Web; System.Web.UI; System.Data; System.Web.UI.WebControls; System.Data.SqlClient; System.Web.UI.HtmlControls
Classes used in this sample:
Control; DataBinder; Binder; Page; Container; SqlDataAdapter; DataSet; RequiredFieldValidator; SqlConnection; DataAdapter; DropDownList; DataList; EventArgs; WebControl; Object; Table; File; TextBox; HtmlControl
Intro10 Sample
This sample demonstrates a modification of the previous Intro9 sample to customize data information.
Link to the online sample documentation
Link to the online sample source code
Namespaces used in this sample:
System.Data; System; System.Data.SqlClient
Classes used in this sample:
Binder; Container; DataBinder; SqlDataAdapter; DataSet; Header; SqlConnection; Import; DataAdapter; Table; File; EventArgs; Object
Intro12 Sample
This sample performs a Page.IsValid check before executing a database lookup on the specified category. ASP.NET page developers can check the Page.IsValid property at run time to determine whether all validation server controls on a page are currently valid.
Link to the online sample documentation
Link to the online sample source code
Namespaces used in this sample:
System.Data; System; System.Data.SqlClient
Classes used in this sample:
Binder; Container; DataBinder; SqlDataAdapter; Import; DataSet; DataAdapter; RequiredFieldValidator; Control; SqlConnection; Page; Object; File; EventArgs; Table
Intro11 Sample
This sample demonstrates how to use two <asp:requiredfieldvalidator runat=server> controls on a page to validate the contents of the TextBox and DropDownList controls.
Link to the online sample documentation
Link to the online sample source code
Namespaces used in this sample:
System.Data; System; System.Data.SqlClient
Classes used in this sample:
Container; DataBinder; Binder; SqlDataAdapter; DataSet; DataAdapter; RequiredFieldValidator; Control; SqlConnection; Import; Object; File; EventArgs; Table
Intro9 Sample
This sample demonstrates using the DataList control and a custom ItemTemplate template to customize data information.
Link to the online sample documentation
Link to the online sample source code
Namespaces used in this sample:
System.Data; System; System.Data.SqlClient
Classes used in this sample:
Container; DataBinder; Binder; SqlDataAdapter; DataSet; SqlConnection; Import; DataAdapter; Table; File; EventArgs; Object
Intro8 Sample
This sample demonstrates ASP.NET data grid and list controls. These can be used to provide custom UI driven from queries against a database or other data source. This sample demonstrates how an <asp:datagrid runat=server> control can be used to bind book information collected using an SQL database query.
Link to the online sample documentation
Link to the online sample source code
Namespaces used in this sample:
System.Data; System; System.Data.SqlClient
Classes used in this sample:
SqlDataAdapter; DataSet; SqlConnection; Import; DataAdapter; Style; Table; File; DataGrid; Header; EventArgs; Object
Intro6 Sample
This sample demonstrates how an ASP.NET page developer can handle the OnClick event from the <asp:button runat=server> control to manipulate the Text property of the <asp:label runat=server> control.
Link to the online sample documentation
Link to the online sample source code
Namespaces used in this sample:
(none)
Classes used in this sample:
Message; File; Object; EventArgs
Intro2 Sample
This sample demonstrates how <% %> render blocks can be used to loop over an HTML block (increasing the font size each time).
Link to the online sample documentation
Link to the online sample source code
Namespaces used in this sample:
(none)
Classes used in this sample:
Page
Intro4 Sample
This sample uses four server controls: <form runat=server>, <asp:textbox runat=server>, <asp:dropdownlist runat=server>, and <asp:button runat=server>. At run time, these server controls automatically generate HTML content.
Link to the online sample documentation
Link to the online sample source code
Namespaces used in this sample:
(none)
Classes used in this sample:
Page
Intro5 Sample
This sample demonstrates how the <asp:adrotator> control can be used to dynamically display rotating ads on a page. In addition to supporting standard HTML input controls, ASP.NET enables developers to use richer custom controls on their pages.
Link to the online sample documentation
Link to the online sample source code
Namespaces used in this sample:
(none)
Classes used in this sample:
Page; File
Intro3 Sample
This sample demonstrates how <% %> code blocks can be used to interpret results posted back from a client. ASP.NET page developers can use <% %> code blocks to dynamically modify HTML output much as they would with ASP.
Link to the online sample documentation
Link to the online sample source code
Namespaces used in this sample:
(none)
Classes used in this sample:
String; Page