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
237 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this Article, I will provide a few tips in problem and solution manner. Opening an ASPX page in Visual studio 2003 is very slow. To make it fast, please do follow below steps:   Open the Solution/Project. Right click the ASPX file to b…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

756 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