This simple example shows how to use code-behinds in ASP.NET. The following code fills a dropdown box selecting data from the pubs database. This is an example method of separating presentation from business logic.
using System; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.HtmlControls; using System.Data; using System.Data.SqlClient; using System.Configuration;
public class myCodeBehind : System.Web.UI.Page { public DropDownList atMyDropDownList;