⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 simple-repeated-binding.aspx

📁 This is a book about vb.you could learn this from this book
💻 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>&lt;select&gt;</b> element:<br />
<select id="MySelectList" runat="server" /><p />

<b>&lt;ASP:DropDownList&gt;</b> control:<br />
<ASP:DropDownList id="MyDropDown" runat="server" /><p />

<b>&lt;ASP:ListBox&gt;</b> control:<br />
<ASP:ListBox id="MyASPList" runat="server" /><p />

<b>&lt;ASP:DataGrid&gt;</b> control:<br />
<ASP:DataGrid id="MyDataGrid" runat="server" /><p />

<b>&lt;ASP:Repeater&gt;</b> control:<br />
<ASP:Repeater id="MyRepeater" runat="server">
  <ItemTemplate>
    <%# Container.DataItem %>
  </ItemTemplate>
</ASP:Repeater><p />


</td><td nowrap="nowrap">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</td><td nowrap="nowrap">


<b>&lt;ASP:DataList&gt;</b> control:<br />
<ASP:DataList id="MyDataList" runat="server">
  <ItemTemplate>
    <%# Container.DataItem %>
  </ItemTemplate>
</ASP:DataList><p />

<b>&lt;ASP:CheckBoxList&gt;</b> control:<br />
<ASP:CheckBoxList id="MyCheckList" runat="server" /><p />

<b>&lt;ASP:RadioButtonList&gt;</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 + -