Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

HOW TO: Create a Table of Contents to Filter Database Results Using ASP with FrontPage 2000


View products that this article applies to.

This article was previously published under Q280328

↑ Back to the top


Summary

This article describes how to dynamically create a table of contents with Active Server Pages (ASP) for use with the Database Results Wizard.

NOTE: This article uses custom Dynamic Hypertext Markup Language (DHTML) and cascading style sheets (CSS) that may not be available in all browsers.

For more information about this topic, click Microsoft FrontPage Help on the Help menu, type compatibility in the Answer Wizard, and then click Search to view the topic.

Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements.
NOTE: You may receive an error message if you copy the examples directly from this article and paste them into FrontPage. The angle brackets (< and >) may appear as escaped HTML code (< and >). To work around this behavior, paste the script into a blank Notepad document, and then copy it from Notepad before you paste it into FrontPage.

Table of Contents Example

The following steps demonstrate how to create a dynamic table of contents for the Database Results Wizard to use.

  1. Open a Web site on a Microsoft Internet Information Services-based Web server.
  2. Start a new page, and switch to HTML view.
  3. Remove all the existing HTML, and type the following code:
    <html>
    <head>
    <!-- this is a style sheet used for DHTML hover effects on the buttons -->
    <style>
    .normal  { BACKGROUND-COLOR: #cccccc; COLOR: #000000 }
    .hover   { BACKGROUND-COLOR: #0000ff; COLOR: #ffffff }
    .current { BACKGROUND-COLOR: #ff0000; COLOR: #ffffff }
    </style>
    </head>
    <body>
    <table border="0" cellpadding="0" cellspacing="0">
    <tr>
    <%
      ' declare variables
      Dim X, strClass
    
      ' loop through the letters A-Z
      For X = 0 To 26
    
        ' output the starting TD & FORM tags
        Response.Write "<td><form action="""
        Response.Write Request.ServerVariables("URL")
        Response.Write """ method=""POST"">"
    
        ' find the current button
        If (Request("CustomerID") = Chr(X+64)) Or (Len(Request("CustomerID"))=0 And X=0) Then
          strClass = "current"
        Else
          strClass = "normal"
        End If
    
        ' output the search buttons
        Response.Write "<input type=""submit"" value="""
        If X > 0 Then    
        	Response.Write Chr(X+64) & """ style=""width:20"" name=""CustomerID"""
        Else
        	Response.Write "ALL"" style=""width:40"""
        End If    
        Response.Write " class=""" & strClass
        Response.Write """ onMouseover=""this.className='hover'"""
        Response.Write " onMouseout=""this.className='" & strClass & "'"">"
    
        ' output the closing FORM & TD tags
        Response.Write "</form></td>" & vbCrLf
    
      ' end the loop
      Next
    %>
    </tr>
    </table>
    </body>
    </html>
    					
  4. Switch back to normal view.
  5. On the Insert menu, click Database and then click Results.
  6. Select Sample Database Connection (Northwind), and then click Next.
  7. Select Customers as the record source, and then click Next.
  8. Click the More Options button.
  9. Click the Criteria button.
  10. Click the Add button.
  11. Select CustomerID for the Field Name.
  12. Select Begins With for the Comparison.
  13. Click OK three times.
  14. Click Next twice.
  15. Clear the Add search form check box.
  16. Click Finish.
  17. Save the page as dbtoc.asp in your Web site.
  18. Click Preview in Browser on the standard toolbar in FrontPage.
When a user browses this page by using HTTP, the page displays a table of contents, followed by the output of the FrontPage Database Results Wizard. When a user clicks a button in the table of contents, the database is filtered for data that begins with the letter that is clicked.

↑ Back to the top


Keywords: KB280328, kbhowtomaster, kbhowto

↑ Back to the top

Article Info
Article ID : 280328
Revision : 2
Created on : 6/18/2005
Published on : 6/18/2005
Exists online : False
Views : 223