searchresults.aspx

来自「visual studio.net学习资料」· ASPX 代码 · 共 125 行

ASPX
125
字号

<!-- ===========================================================================
 
  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: SearchResult.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 DataList control

============================================================================ -->


<%@ Page Language="vb" %>
<%@ Register TagPrefix="Conference" TagName="Header" Src="_Header.ascx" %>
<%@ Register TagPrefix="Conference" TagName="Menu" Src="_Menu.ascx" %>

<script language="VB" runat="server">
    
    '*******************************************************
    '
    ' The Page_Load event on this page is used to obtain 
    ' from a database a collection of all products whose
    ' description or name meets a specified search criteria.
    '
    ' The search criteria is an argument to the page.
    '
    ' Other source code to examine:  
    '     Conference.ProductDB.SearchProductDescriptions() Method
    '
    '*******************************************************
    
    Sub Page_Load(sender As Object, e As EventArgs) 

        ' Search database using the supplied "txtSearch" parameter
        Dim productCatalog As New Conference.ProductsDB
        lstData.DataSource = productCatalog.SearchProductDescriptions(Request.Params("txtSearch")).Tables(0).DefaultView
        lstData.DataBind()
        
        ' Hide the result list and display a message if no results are found
        If (lstData.Items.Count = 0) Then
            lstData.Visible = false
            ErrorMsg.Text = "No items matched your query."
        End If
        
    End Sub

</script>

<html>
    <head>
        <link rel="stylesheet" type="text/css" href="Conference.css">
    </head>

    <body background="images/sitebkgrd.gif" leftmargin="0" topmargin="0" rightmargin="0" bottommargin="0" marginheight="0" marginwidth="0">
                        

    <!-- HEADER AND MENUS -->

    <table width="100%" border=0>

      <tr><td><Conference:Header runat="server"/></td></tr>
      <tr><td>
          <table width="100%" border=0>
            <tr><td valign="top">
                  <Conference:Menu runat="server"/>
                </td>
                <td>


    <!-- CONTENT -->

                   <asp:DataList id="lstData"  RepeatColumns="2" runat="server" > 
                                                            
                        <template name="ItemTemplate">
                                                                                                                   
                              <table border=0 width="275">
                                     <tr>
                                         <td width="200" valign="center">
                                              <a href="ProductDetails.aspx?productID=<%# Container.DataItem("ProductID") %>">
                                                   <%# Container.DataItem("ModelName") %><br>
                                              </a>
                                              <b>Price: </b><%# System.String.Format("{0:c}", Container.DataItem("UnitCost"))%><br>
                                              <a href="AddToCart.aspx?productID=<%# Container.DataItem("ProductID") %>"><font color="#313179"><b>Add To Cart<b></font></a>
                                           </td>
                                       </tr>
                                 </table>

                           </template>
                                                                        
                     </asp:DataList> 
                                                        
                     <asp:Label id="ErrorMsg" text="" class="ErrorText"  runat="server"/>
                                                        
    <!-- END OF CONTENT -->  

                </td>

             </tr>

          </table>

      </td></tr>

    </table>


    <!-- END OF HEADER AND MENU -->        

    </body>
</html>

⌨️ 快捷键说明

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