01.
<%@ Page Language=
"C#"
Debug=
"true"
%>
02.
<script runat=
"server"
>
03.
void
Page_Load(
object
sender, EventArgs e)
04.
{
05.
Hashtable objHashtable;
06.
int
i;
07.
08.
objHashtable =
new
Hashtable();
09.
10.
objHashtable.Add(
"white"
,
"#FFFFFF"
);
11.
objHashtable.Add(
"black"
,
"#000000"
);
12.
objHashtable.Add(
"red"
,
"#FF0000"
);
13.
objHashtable.Add(
"yellow"
,
"#FFFF00"
);
14.
objHashtable.Add(
"green"
,
"#00FF00"
);
15.
16.
17.
if
(objHashtable.ContainsKey(
"red"
) ==
true
)
18.
{
19.
this
.lblText.Text =
"[red] is a member"
;
20.
}
21.
else
22.
{
23.
this
.lblText.Text =
"[red] no a member"
;
24.
}
25.
26.
}
27.
</script>
28.
<html>
29.
<head>
30.
<title>ThaiCreate.Com ASP.NET - Hashtable</title>
31.
</head>
32.
<body>
33.
<form id=
"form1"
runat=
"server"
>
34.
<asp:Label id=
"lblText"
runat=
"server"
></asp:Label>
35.
<br />
36.
</form>
37.
</body>
38.
</html>