Go Premium for a chance to win a PS4. Enter to Win

x
?
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
Medium Priority
?
241 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 2000 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

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

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

A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
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 anti-spam), the admin…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Suggested Courses

885 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