Catagories into Subcatagories

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Fary4u
    Contributor
    • Jul 2007
    • 273

    Catagories into Subcatagories

    Hi every one any body can help me in this regards ? i don't know how to do that
    how do i convert following code into sub catagory ?
    like . . .

    [PHP]

    Computer
    Mainboards
    Keyboards
    Mouse
    Process
    Intel
    AMD

    these catagories i've got in database

    <%
    Dim Conn, rsCatalog
    Set Conn = Server.CreateOb ject("ADODB.Con nection")
    Conn.Open ConString
    Set rsCatalog = Conn.Execute("S ELECT * FROM catalogs")
    While Not rsCatalog.EOF

    Response.Write rsCatalog("cata logID")
    rsCatalog.MoveN ext
    Wend
    rsCatalog.Close
    Set rsCatalog = Nothing
    %>

    but when i display it's just like not with subcatagories ?

    Computer
    Mainboards
    Keyboards
    Mouse
    Process
    Intel
    AMD

    [/PHP]

    but i want just main 2 catagories like Computer & Process then any body click on the Computer section then it's bring subcatagories ?
  • jeffstl
    Recognized Expert Contributor
    • Feb 2008
    • 432

    #2
    What you are describing will take a good amount of work in just ASP. If you want a true treeview you will need to use a javascript, or flash or something else that executes locally on the browser.
    Some ideas and discussions on this:


    However, as an alternative I would propose you use a drop down menu to select which category you want, then display the sub-categories on the next page after the user makes a selection.

    Like the following:
    [code=asp] <select name="sltCatego ries" id="select">
    <option selected value="0">None Selected</option>
    <% do while not CategoriesRS.EO F
    response.write "<option value=" & CategoriesRS("C ategory_Key") & ">"
    response.write RaceRS("Categor y_Name")
    response.write "</option>"
    CategoriesRS.Mo veNext
    loop
    %>
    </select>[/code]

    Then on the form submit set the action property to the page you want the sub categories to display on, and get the category selected with:
    dim CategorySelecte d
    CategorySelecte d = request.form("s ltCategories")

    Just a simpler idea then a treeview, depending on your situation.
    Last edited by jhardman; Feb 22 '08, 12:36 AM. Reason: put code in code tags. Please note button marked - #

    Comment

    Working...