Visualizzazione dei risultati da 1 a 6 su 6

Discussione: stampa sottomenu

  1. #1

    stampa sottomenu

    Ho un problema che ricorre

    semplice menu con sottomenu

    <%
    Dim idmenu
    set Menu = Server.CreateObject("ADODB.Recordset")
    sql = "select * from Menu "
    Menu.ActiveConnection = cn
    Menu.Open sql, cn
    %>
    <table width="100%" border="0" cellspacing="1" cellpadding="1">
    <%
    Do while not Menu.EOF
    idmenu = Menu("IDMenu")
    %>
    <tr>
    <td>&idm=<%=(idmenu)%>" class="contenuto"><%=Menu("voce")%>
    <%
    Dim idm
    idm = request.QueryString("idm")
    set Sottomenu = Server.CreateObject("ADODB.Recordset")
    sql = "select * from Sottomenu where IDMenu =" & idm
    Sottomenu.ActiveConnection = cn
    Sottomenu.Open sql, cn
    %>
    <%if not Sottomenu.EOF then%>


    <%Do while not Sottomenu.EOF%>
    <%=Sottomenu("voce")%>

    <%
    Sottomenu.movenext
    loop
    Sottomenu.close()
    Set Sottomenu = nothing
    %>
    <%end if%>
    </td>
    </tr>
    <tr>
    <td background="./images/linea_menu.gif">[img]./images/pixel.gif[/img]</td>
    </tr>
    <%
    Menu.movenext
    loop
    %>
    </table>
    <%
    Menu.close()
    Set Menu = nothing
    %>

    così facendo quando trova 1 sottomenu lo stampa sotto tutte le voci....come posso farlo stampare solo sotto la voce giusta?

  2. #2
    if Menu("id")=idm then
    'cerco il sottomenu
    'stampo il sottomenu

  3. #3
    Santino ho provato la tua soluzione e la logica è giusta ma non mi funziona, forse non lo piazzo nel posto giusto, io faccio il loop del menu principale (Menu 1) , nel mentre controllo il menu 2 per ogni "bottone" facendo il confronto con la QueryString per pescare , al che controllo se la tabella è EOF oppure no e poi ci metto quello che mi hai suggerito if Menu("IDMenu") = idm then

    <table width="100%" border="0" cellspacing="1" cellpadding="1">
    <%
    Do while not Menu.EOF
    idmenu = Menu("IDMenu")
    %>
    <tr>
    <td>&idm=<%=(idmenu)%>" class="contenuto"><%=Menu("voce")%>
    <%
    Dim idm
    idm = request.QueryString("idm")
    set Sottomenu = Server.CreateObject("ADODB.Recordset")
    sql = "select * from Sottomenu where IDMenu =" & idm
    Sottomenu.ActiveConnection = cn
    Sottomenu.Open sql, cn
    %>
    <%
    if not Sottomenu.EOF then
    if Menu("IDMenu")= idm then
    %>



    <%Do while not Sottomenu.EOF%>
    <%=Sottomenu("voce")%>

    <%
    Sottomenu.movenext
    loop
    Sottomenu.close()
    Set Sottomenu = nothing
    %>
    <%
    end if
    end if
    %>
    </td>
    </tr>
    <tr>
    <td background="./images/linea_menu.gif">[img]./images/pixel.gif[/img]</td>
    </tr>
    <%
    Menu.movenext
    loop
    %>
    </table>

    ma così facendo non stampa proprio :master:

  4. #4
    spetta spetta....

    if idmenu= 3 then
    (forzo il 3)


    ...allora funziona
    :master: questo vuol dire che non mi legge la quesystring

  5. #5
    if idmenu = Cint(idm) then grazie per il suggerimento santino

  6. #6
    si in effetti spesso (a sto punto andrebbe fatto sempre) bisogna convertire i tipi delle var per farle confrontare bene

    bella pe te

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.