Results 1 to 2 of 2

Thread: ASP - Populating Menu Link

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2000
    Location
    Seattle
    Posts
    954

    ASP - Populating Menu Link

    I want to dynamically create my menus. To do this I am looping through a rs and placing a link and name in a table.

    Here is the code

    <html>
    <title>Brian's Home Page</title>
    <head>
    <%
    dim objRs, objConn, strSQL

    set objConn = Server.CreateObject("ADODB.Connection")
    objConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\inetpub\wwwroot\db\dbWebsite.mdb"
    strSQL = "Select * from tblMenu"
    set objRs = Server.CreateObject("ADODB.Recordset")

    objRs.Open strSQL, objConn
    %>
    </head>
    <body>
    <table width="500" border="0" bgcolor="#006666">
    <tr>
    <td height="20" width="100"><a href="default.htm">Home</a> </td>
    <td height="20" width="100"><a href="default.htm">Home</a> </td>
    <td height="20" width="100"><a href="default.htm">Home</a> </td>
    <td height="20" width="100"><a href="default.htm">Home</a> </td>
    <td height="20" width="100"><a href="default.htm">Home</a> </td>
    </tr>
    </table>
    <table border="0" width="60" bgcolor="#006666">
    <tr>
    <%
    while not objrs.eof
    response.write "<td><a href=>" & objRs("Link") & objrs("MenuItems") & "</a></td></tr>"
    objRs.movenext
    wend%>
    </table>
    </body>
    </html>

    The Link RS is the link and the MenuItems RS would be what I want to appear as the link to click on.....Instead it shows both entries as text and hyperlinks in the table...Any suggestions?

  2. #2
    Fanatic Member Psyrus's Avatar
    Join Date
    Jul 2000
    Location
    NJ
    Posts
    602
    This might be the problem:

    <a href=>" & objRs("Link") & objrs("MenuItems") & "</a>


    Try this:

    "<a HREF = '" & objRS("Link") & "'>" & objRS("MenuItems") & "</a>"



    Chris
    Chris

    VB 6.0 Calendar App Video Gamers Group
    Don't forget to rate people if they helped you.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width