Tree View control & web.sitemap - Problem - ( plz help... its really urgent...)

Rate It (1)

Last post 03-30-2006 7:05 AM by vishal_0009. 1 replies.

Sort Posts:

  • Tree View control & web.sitemap - Problem - ( plz help... its really urgent...)

    03-29-2006, 4:47 AM
    • Member
      680 point Member
    • vishal_0009
    • Member since 09-15-2005, 9:20 AM
    • Posts 136
    Hello there guys,

    I m having a little problem to implement the Tree view web control with the Web.Sitemap File.

    I m using the treeview web control in the master page on the left hand side and content place holder on the right hand side. Now, the tree view control is getting the ( data / content ) - node from the Web.Sitemap file.

    My tree view looks like :

    -     Home
           -    Page A   
                 -    Page 1
           -    Page B

    And the Web.Site map file :

    <?xml version="1.0" encoding="utf-8" ?>

    <siteMap>
     
      <siteMapNode title="Home" url="Home.aspx">

        <siteMapNode title="Page A" url="PageA.aspx" >

          <siteMapNode title="Page 1" url="Page1.aspx" />
                
        </siteMapNode>
         
     </siteMapNode>

    </siteMap>

    Now, if user clicks on Page A in the Tree view - it displays a list of products in the grid view which it gets from the database and Highlights the Page A in the tree view. If user clicks on any of the products, it display its details on Page 1- and highlights the Page 1.

    But wat I want to do is - If user clicks on any of the products from the product list on PageA, it display its details on Page 1, but Highlights the Page A and not the Page 1, and also I don't want the Page 1 appear in the tree view.

    Well, I can make it that Page 1 not appear in the Tree view - by taking off the following line from the web.sitemap file.

    <siteMapNode title="Page 1" url="Page1.aspx" />

    But how could I still Highlights the Page A - in the tree view, though the user is on the Page 1?

    I think it should be simple and have to put some code in the Web.Sitemap file. But I m new to .Net, so don't really much know about it. So, if you guys plz help me with it, then it'll be gr8.

    Or the other thing by clickin on Page A in the tree view -  the user is  presented with the product list. If user clicks on any of the product to view its details, is it any how possible that - It adds that particular product in the Treeview - as child node of the Page A - and highlights that particulat product. If it's possible then how it could be done?

    If you require n e further info, then plz let me know.

    If you guys have faced the similar problems and have solutions then plz help me to sort it out. Or is there n e sample code or links available, then plz point me to that.

    I m looking forward to hear from you guys.

    Many thanks,

    vish.






  • Re: Tree View control & web.sitemap - Problem - ( plz help... its really urgent...)

    03-30-2006, 7:05 AM
    • Member
      680 point Member
    • vishal_0009
    • Member since 09-15-2005, 9:20 AM
    • Posts 136
    Hello there,

    I think it shouldn't be this hard to solve this. But its not easy as it seems to be. But there should be some way round it to do this.

    In, simple words If I explain again what I really want to implement is : that I would like to highlight the root node of the tree view control while browsing the child node.

    For example, 
    my tree view looks like following :

    - Home
           - Product List
                 - Product Details

    And the Web.Sitemap file :

    <?xml version="1.0" encoding="utf-8" ?>

    <siteMap>
     
      <siteMapNode title="Home" url="Home.aspx">

        <siteMapNode title="Product List" url="ProductList.aspx" >

          <siteMapNode title="Product Details" url="ProductDetails.aspx" />
                
        </siteMapNode>
         
     </siteMapNode>

    </siteMap>

    Now, if user selects the Product List - it gets highlighted and tree view looks like:

    - Home
           - Product List
                 - Product Details

    But, what steps I have to take or what I need to do, so that even I am browsing Product Details, child node of the Product list, my tree view still highlights the root nodeProduct list and not its child node - Product Details and it also doesn't display the child node - Product Details too.

    N, it makes my tree view some thing looks like :

    - Home
           - Product List

    I've come across to the other post on this forum and there I found the Following answer:
    http://forums.asp.net/thread/1223453.aspx

    if (e.item node == sitemap.currentnode.parent)
              item.text = "<span class=\"selectedItemCSS\">" + text + "</span>";

    But I am not sure where do I have to put this code?

    So, if any one knows or have answer to this, plz reply.

    Thanks in advance.

    Vish.
               


Page 1 of 1 (2 items)