<%@ Page Language="C#" Debug="true" Trace="true" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
const int _itemCount = 10;
string GetDisplayItem(int n)
{
return "Item #" + n.ToString();
}
protected override void OnLoad(EventArgs e)
{
_displayList.Items.Clear();
for (int i=0; i<_itemCount; i++)
_displayList.Items.Add(new ListItem(GetDisplayItem(i)));
_messageH2.InnerText = "Total number of items = " + _itemCount.ToString();
base.OnLoad(e);
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>Simple page with controls</title>
</head>
<body>
<form runat="server" id="_form" >
<h1>Test ASP.NET 2.0 Page with controls</h1>
<asp:BulletedList runat="server" ID="_displayList">
<asp:ListItem>Sample Item 1</asp:ListItem>
<asp:ListItem>Sample Item 2</asp:ListItem>
<asp:ListItem>Sample Item 3</asp:ListItem>
</asp:BulletedList>
<h2 runat="server" id="_messageH2">Total number of items = xx</h2>
</form>
</body>
</html>
|