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

📄 simple-repeater-template.aspx

📁 This is a book about vb.you could learn this from this book
💻 ASPX
字号:
<%@Page Language="VB"%>

<%@Import Namespace="System.Data" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head>
<title>Using a Simple Template with a Repeater Control</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}

.rHead {font-family:Lucida Handwriting,Comic Sans MS,Tahoma,Arial;
        font-size:14pt; font-weight:bold; padding:8px; color:green}
.rItem {font-family:Lucida Handwriting,Comic Sans MS,Tahoma,Arial,sans-serif;
        font-size:10pt}
.rFoot {font-family:Tahoma,Arial; font-size:8pt; padding:8px; color:darkgray}

</style></head>
<body bgcolor="#ffffff">
<span class="heading">Using a Simple Template with a Repeater Control</span><hr />
<!--------------------------------------------------------------------------->

<ASP:Repeater id="MyRepeater" runat="server">

  <HeaderTemplate>
    <div class="rHead">
      Some of the Latest Wrox Press Books<br />
      <img src="images/redrule.gif">
    </div>
  </HeaderTemplate>

  <ItemTemplate>
    <div class="rItem">
      <img src="images/<%# Container.DataItem("ImageURL") %>"
           align="left" hspace="10" />
      <b><%# Container.DataItem("Title") %></b><br />
      ISBN: <%# Container.DataItem("ISBN") %> &nbsp;
      Published: <%# DataBinder.Eval(Container.DataItem, _
                     "PublicationDate", "{0:d}") %><br />
      <%# Container.DataItem("Precis") %>
    </div><br clear="all" />
  </ItemTemplate>

  <SeparatorTemplate>
    <img src="images/redrule.gif">
  </SeparatorTemplate>

  <FooterTemplate>
    <img src="images/redrule.gif">
    <div class="rFoot">
      For more information visit <a href="http://www.wrox.com">http://www.wrox.com</a>
    </div>
  </FooterTemplate>

</ASP:Repeater><p />

<!--------------------------------------------------------------------------->

<script language="vb" runat="server">

Sub Page_Load()

   'create a new empty DataTable object
   Dim objTable As New DataTable("NewTable")

   'define four columns (fields) within the table
   objTable.Columns.Add("ISBN", System.Type.GetType("System.String"))
   objTable.Columns.Add("Title", System.Type.GetType("System.String"))
   objTable.Columns.Add("PublicationDate", System.Type.GetType("System.DateTime"))
   objTable.Columns.Add("ImageURL", System.Type.GetType("System.String"))
   objTable.Columns.Add("Precis", System.Type.GetType("System.String"))

   'declare a variable to hold a DataRow object
   Dim objDataRow As DataRow

   'create a new DataRow object instance in this table
   objDataRow = objTable.NewRow()

   'and fill in the values
   objDataRow("ISBN") = "1861004478"
   objDataRow("Title") = "Professional Application Center 2000"
   objDataRow("PublicationDate") = "2001-03-01"
   objDataRow("ImageURL") = "appcenter.gif"
   objDataRow("Precis") = "This book takes you through the complete process of setting up " _
      & "and creating Web clusters and component clusters, adapting your applications to " _
      & "work in a clustered scenario, and how you can administer and monitor them."
   objTable.Rows.Add(objDataRow)

   objDataRow = objTable.NewRow()
   objDataRow("ISBN") = "1861004753"
   objDataRow("Title") = "A Preview of ASP+"
   objDataRow("PublicationDate") = "2000-07-01"
   objDataRow("ImageURL") = "aspplus.gif"
   objDataRow("Precis") = "Active Server Pages (ASP.NET) makes it easier, faster and less " _
      & "error-prone to write your own Web applications and dynamic Web pages. In a lot " _
      & "of cases, there is actually less code to write - and sometime none at all. "
   objTable.Rows.Add(objDataRow)

   objDataRow = objTable.NewRow()
   objDataRow("ISBN") = "1861004028"
   objDataRow("Title") = "Professional ASP XML Programming"
   objDataRow("PublicationDate") = "2000-05-01"
   objDataRow("ImageURL") = "aspxml.gif"
   objDataRow("Precis") = "As ASP is probably the best server-side coding platform for " _
      & "Windows-based systems, it's an obvious choice for use with XML. This book looks " _
      & "at all of the XML-related issues you will face when working in this environment."
   objTable.Rows.Add(objDataRow)

   objDataRow = objTable.NewRow()
   objDataRow("ISBN") = "1861002882"
   objDataRow("Title") = "Beginning Components for ASP"
   objDataRow("PublicationDate") = "2000-03-01"
   objDataRow("ImageURL") = "components.gif"
   objDataRow("Precis") = "If you use ASP, you're only getting half the power of this " _
      & "exciting programming environment if you don't build and use components. This book " _
      & "shows you how to get started, with plenty of tips, tricks and useful information."
   objTable.Rows.Add(objDataRow)

   'assign the DataTable's DefaultView object to the Repeater control
   MyRepeater.DataSource = objTable.DefaultView
   MyRepeater.DataBind()  'and bind (display) the data

End Sub

</script>

<!--------------------------------------------------------------------------->
<!-- #include file="..\global\foot.inc" -->
</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -