Solved

I created a asp.net page that return subcategories based on the  category id.  how can i create a path on top of the page look something like this: home >> category1 >> category88 >> category123 >> pr

Posted on 2004-10-17
5
231 Views
Last Modified: 2008-03-10
I created a asp.net page that return subcategories based on the  category id.  how can i create a path on top of the page look something like this: home >> category1 >> category88 >> category123 >> product. Example please.
0
Comment
Question by:musclejack
5 Comments
 
LVL 6

Expert Comment

by:ryerras
ID: 12335279
wht u mean by "path on top of the page"
0
 
LVL 6

Expert Comment

by:ryerras
ID: 12335291
You mean a Menu?
0
 
LVL 18

Expert Comment

by:DotNetLover_Baan
ID: 12336275
Try BreadCrumb. Take a look here: http://www.codeproject.com/aspnet/breadcrumbs.asp
-Baan
0
 
LVL 7

Accepted Solution

by:
sukumar_diya earned 500 total points
ID: 12337164
Hi,
You can use User Defined functions in the database( Assumed you are using MSSQL). Please have a look into the following Function that will return the parent path if the categoryid is given. The @ParentId is the categoryid. Please modify the function according to your table structure or post your table structure and some sample data so that we can help you.

CREATE FUNCTION dbo.GetParentCatPath(@ParentId int)
RETURNS VARCHAR(2000) AS
BEGIN
      DECLARE @blnExit       AS BIT,
            @vchResult       AS VARCHAR(2000),
            @CatId            AS INT,
            @CatName      AS VARCHAR(100)

      SET       @blnExit=0
      SET       @vchResult=''

      WHILE @blnExit=0
      BEGIN

            SELECT       @ParentId=CM.ct_ParentCategoryID,
                  @CatId=CM.ct_ID,
                  @CatName=CM.ct_CategoryName
            FROM       category_master CM
            WHERE       CM.ct_ID=@ParentId

            IF @vchResult<>''
                  SET       @vchResult= @CatName + ' '+ '>' + ' ' + @vchResult
            ELSE
                  SET       @vchResult= @CatName

            IF @ParentId=0
                  SET      @blnExit=1

      END

      RETURN @vchResult
END


Hope this helps you,
Cheers,
Sukumar


0
 
LVL 17

Expert Comment

by:AerosSaga
ID: 12337663
Private Sub GetTierNames(ByVal ProductID As Integer)
        Dim cnn As New OleDb.OleDbConnection(ConfigurationSettings.AppSettings("SiteDB"))
        Dim cmd As New OleDb.OleDbCommand
        Dim dr As OleDb.OleDbDataReader
        Dim Tier1ID, Tier2ID, Tier3ID As Integer
        cmd.CommandType = CommandType.Text
        cmd.CommandText = _
        "SELECT Products.ProductID,Tier1.Name,Tier2.Tier1ID,Tier2.Name,Tier2.Tier2ID,Tier3.Name,Tier3.Tier3ID FROM Tier3 " & _
        "RIGHT JOIN (Tier2 RIGHT JOIN (Tier1 RIGHT JOIN Products " & _
        "ON Tier1.Tier1ID = Products.Tier1ID) " & _
        "ON Tier2.Tier2ID = Products.Tier2ID) " & _
        "ON Tier3.Tier3ID = Products.Tier3ID " & _
        "WHERE ProductID = " & ProductID.ToString()
        cmd.Connection = cnn
        cnn.Open()
        dr = cmd.ExecuteReader(CommandBehavior.CloseConnection)
        dr.Read()
        Tier1ID = CInt(dr("Tier1ID"))
        Tier2ID = CInt(dr("Tier2ID"))
        Tier3ID = CInt(dr("Tier3ID"))
        Me.HyperLink2.NavigateUrl = "Index.aspx"
        Me.HyperLink2.Text = CStr(dr("Tier1.Name"))
        Me.Hyperlink3.NavigateUrl = "DisplayTiers.aspx?Tier2ID=" & Tier2ID
        If Not dr("Tier2.Name") Is DBNull.Value Then
            Hyperlink3.Text = CStr(dr("Tier2.Name"))
        End If
        Me.Hyperlink4.NavigateUrl = "DisplayProducts.aspx?Tier3ID=" & Tier3ID
        If Not dr("Tier3.Name") Is DBNull.Value Then
            Hyperlink4.Text = CStr(dr("Tier3.Name"))
        End If

        cnn.Close()
        cmd.Dispose()
        cnn.Dispose()
    End Sub

Heres the page it produces

http://dev.savoyfurniture.com/ProductDetail.aspx?ProductID=146

Aeros
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now