File: databind-arraylist.aspx

package info (click to toggle)
xsp 3.8-2.1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 5,352 kB
  • ctags: 2,452
  • sloc: cs: 13,500; sh: 12,512; xml: 8,279; perl: 1,189; makefile: 765; ansic: 299; php: 6
file content (32 lines) | stat: -rw-r--r-- 937 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<%@ Page Language="C#" %>
<%@ Register TagPrefix="mono" TagName="MonoSamplesHeader" src="~/controls/MonoSamplesHeader.ascx" %>
<html>
<head>
	<script runat="server">
	private void Page_Load (object sender, EventArgs e)
	{
		if (!IsPostBack){
			optionsList.Add ("One");
			optionsList.Add ("Two");
			optionsList.Add ("Three");
			optionsList.Add ("Four");
			optionsList.Add ("Five");
			list.DataSource = optionsList;
			list.DataBind();
		}
		else
			msg.Text = "Selected option: " + list.SelectedItem.Text;
	}
	</script>
<link rel="stylesheet" type="text/css" href="/mono-xsp.css">
</head>
<body><mono:MonoSamplesHeader runat="server"/>
	<object id="optionsList" runat="server" class="System.Collections.ArrayList" />
	<h3>Data binding using an array list</h3>
	<form id="form" runat="server">     
		<asp:DropDownList id="list" runat="server" autopostback="true" />
		<asp:Label id="msg" runat="server" />
	</form>
</body>
</html>