📄 simple-repeated-binding.aspx
字号:
<%@Page Language="VB"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head>
<title>Simple Repeated-Value Data Binding</title>
<style type="text/css">
body, td {font-family:Tahoma,Arial,sans-serif; font-size:10pt}
input {font-family:Tahoma,Arial,sans-serif; font-size:9pt}
.heading {font-family:Tahoma,Arial,sans-serif; font-size:14pt; font-weight:bold}
.subhead {font-family:Tahoma,Arial,sans-serif; font-size:12pt; font-weight:bold; padding-bottom:5px}
.cite {font-family:Tahoma,Arial,sans-serif; font-size:8pt}
</style></head>
<body bgcolor="#ffffff">
<span class="heading">Simple Repeated-Value Data Binding</span><hr />
<!--------------------------------------------------------------------------->
<form runat="server">
<table border="0">
<tr><td nowrap="nowrap">
HTML <b><select></b> element:<br />
<select id="MySelectList" runat="server" /><p />
<b><ASP:DropDownList></b> control:<br />
<ASP:DropDownList id="MyDropDown" runat="server" /><p />
<b><ASP:ListBox></b> control:<br />
<ASP:ListBox id="MyASPList" runat="server" /><p />
<b><ASP:DataGrid></b> control:<br />
<ASP:DataGrid id="MyDataGrid" runat="server" /><p />
<b><ASP:Repeater></b> control:<br />
<ASP:Repeater id="MyRepeater" runat="server">
<ItemTemplate>
<%# Container.DataItem %>
</ItemTemplate>
</ASP:Repeater><p />
</td><td nowrap="nowrap"> </td><td nowrap="nowrap">
<b><ASP:DataList></b> control:<br />
<ASP:DataList id="MyDataList" runat="server">
<ItemTemplate>
<%# Container.DataItem %>
</ItemTemplate>
</ASP:DataList><p />
<b><ASP:CheckBoxList></b> control:<br />
<ASP:CheckBoxList id="MyCheckList" runat="server" /><p />
<b><ASP:RadioButtonList></b> control:<br />
<ASP:RadioButtonList id="MyRadioList" runat="server" /><p />
</td></tr>
</table>
</form>
<!--------------------------------------------------------------------------->
<script language="vb" runat="server">
Sub Page_Load()
'create an ArrayList of values to bind to
Dim arrValues As New ArrayList(5)
arrValues.Add("Microsoft")
arrValues.Add("Sun")
arrValues.Add("IBM")
arrValues.Add("Compaq")
arrValues.Add("Oracle")
'set the DataSource propert of the controls to the array
MySelectList.DataSource = arrValues
MyDropDown.DataSource = arrValues
MyASPList.DataSource = arrValues
MyDataGrid.DataSource = arrValues
MyRepeater.DataSource = arrValues
MyDataList.DataSource = arrValues
MyCheckList.DataSource = arrValues
MyRadioList.DataSource = arrValues
'bind all the controls on the page
Page.DataBind()
End Sub
</script>
<!--------------------------------------------------------------------------->
<!-- #include file="..\global\foot.inc" -->
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -