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
238 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Lots of people ask this question on how to extend the “MembershipProvider” to make use of custom authentication like using existing database or make use of some other way of authentication. Many blogs show you how to extend the membership provider c…
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Suggested Courses

710 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