?? productslist.aspx
字號:
<!-- ===========================================================================
Copyright (C) 2000 Microsoft Corporation
All rights reserved
THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT
LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND/OR
FITNESS FOR A PARTICULAR PURPOSE.
File name: ProductsList.aspx
Application: Conference registration
Tested: with IE5.5 / Windows 2000
This file contains the display of the Conference Content
Technical details:
This page uses the Repeater control
============================================================================ -->
<%@ Page Language="vb" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SQL" %>
<script language="VB" runat="server">
'*******************************************************
'
' The Page_Load event on this page connects
' to the database, fills a DataSet and binds it
' to a repeater control
'
'*******************************************************
Sub Page_Load(Source As Object, E As EventArgs)
' Variable declaration
' Obtain CategoryID from QueryString
Dim categoryID As Integer = _
CInt(Request.Params("CategoryID"))
Dim conn As SQLConnection
Dim strConn As String
Dim cmdProducts As SQLDataSetCommand
Dim paramCategoryID As SQLParameter
Dim dsProducts As New DataSet
' Set the connection string to the Conf database on SQL server
strConn = "server=localhost;uid=sa;pwd=;database=Conf"
' Create the connection
conn = New SQLConnection(strConn)
' Define the command with the name of the stored procedure
cmdProducts = New SQLDataSetCommand("ProductsByCategory", conn)
' Set the CommandType to Stored Procedure
cmdProducts.SelectCommand.CommandType = CommandType.StoredProcedure
' Add input parameter
paramCategoryID = new SQLParameter("@CategoryID", SQLDataType.Int, 4)
paramCategoryID.Value = categoryID
cmdProducts.SelectCommand.Parameters.Add(paramCategoryID)
' Fill the DataSet
cmdProducts.FillDataSet(dsProducts, "Products")
' Bind to the control
repList.DataSource = dsProducts.Tables("Products").DefaultView
repList.DataBind()
End Sub
</script>
<!-- =========================== User Interface ============================ -->
<html>
<head>
<title>ProductList</title>
<link rel="stylesheet" HREF="Conference.css" TYPE="text/css">
</head>
<body background="images/sitebkgrd.gif" leftmargin="0" topmargin="0" rightmargin="0" bottommargin="0" marginheight="0" marginwidth="0">
<Center>
<asp:Repeater id="repList" runat="server">
<!-- Header of the template -->
<template name="HeaderTemplate">
<table height="148">
<tr>
<td class="BackgroundColor1" valign="bottom" align="center" height="56">
<H4><font face="Arial" color="#313179">chairman</font></h4>
</td>
<td class="BackgroundColor2" valign="bottom" align="center" height="56">
<H4><font face="Arial" color="#313179">subject</font></h4>
</td>
<td class="BackgroundColor1" valign="bottom" align="center" height="56">
<H4><font face="Arial" color="#313179">price</font></H4>
</td>
<td class="BackgroundColor2" valign="bottom" align="center" height="56">
<H4><font face="Arial" color="#313179">action</font></h4>
</td>
</tr>
</template>
<!-- Body of the template -->
<template name="ItemTemplate">
<!-- new line in the table -->
<tr>
<td>
<%# Container.DataItem("Chairman") %>
</td>
<td>
<a href='ProductDetails.aspx?productID=<%# Container.DataItem("ProductID") %>'>
<%# Container.DataItem("ModelName") %><br>
</a>
</td>
<td>
<!-- Price -->
<b>Price: </b><%# System.String.Format("{0:c}", Container.DataItem("UnitCost")) %>
<br>
</td>
<td>
<!-- Add to cart action -->
<a href="AddToCart.aspx?productID=<%# Container.DataItem("ProductID") %>">
<b>Add To Cart</b>
</a>
</td>
</tr>
</template>
<!-- Body of the template -->
<template name="AlternatingItemTemplate">
<tr>
<td class="BackgroundColor6">
<%# Container.DataItem("Chairman") %>
</td>
<td class="BackgroundColor5">
<a href='ProductDetails.aspx?productID=<%# Container.DataItem("ProductID") %>'>
<%# Container.DataItem("ModelName") %><br>
</a>
</td>
<td class="BackgroundColor6">
<!-- Price -->
<b>Price: </b><%# System.String.Format("{0:c}", Container.DataItem("UnitCost")) %>
<br>
</td>
<td class="BackgroundColor5">
<!-- Add to cart action -->
<a href="AddToCart.aspx?productID=<%# Container.DataItem("ProductID") %>">
<b>Add To Cart</b>
</a>
</td>
</tr>
</template>
<!-- Footer of the template -->
<template name="FooterTemplate">
</table>
</template>
</asp:Repeater>
</center>
</body>
</html>
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -