Problem with Highlight currently selected treenode

2 posts, 0 answers
  1. bhavesh
    bhavesh avatar
    2 posts
    Member since:
    Jul 2011

    Posted 01 Jul 2011 Link to this post

    Hi All,
             I have  used <asp:TreeView> tag for treeview, and i have set  SelectedNodeStyle & NodeStyle Property such like has shown in below code
    <asp:TreeView ID="TreeView1" ShowLines="false" ShowExpandCollapse="true" runat="server" 
                Height="330px" ExpandDepth="10" CssClass="Normal" ForeColor="#585880" 
                Font-Size="10px"  Font-Names="Verdana" NodeIndent="10" 
                 EnableClientScript="true">
                <SelectedNodeStyle CssClass="treeStyleNodeSelect" ImageUrl="~/Images/leaf.gif"/>            
                <NodeStyle CssClass="treeStyleNode"  ImageUrl="~/Images/leaf.gif"/>
    </asp:TreeView>

                        then  I have generated Treenodes using server side code in c# ,  at that time i  have set cssclass for Particular Treenode which Highlighted such like has shown in  First select Image. after that i don't want to execute server side code 
    so when first time Web Form Load that Particular Node Highlighted such like has shown in  First select Image.

                        Now I selecte another TreeNode at that time that TreeNode HighLghted but Previosly selected TreeNode also Remain Highlighted as Shown in Secend select Image ,Previous TreeNode Remain Highlighted since it's CssClass Property setting in server side code , and next time i don't want to execute server side code,

                            So what can i do to solve this problem , give me reply  please 




  2. Plamen
    Admin
    Plamen avatar
    2969 posts

    Posted 04 Jul 2011 Link to this post

    Hi Bhavesh,

    We recommend using RadTreeView instead of <asp:TreeView>, where it is very easy to change tha color of the selected node only with css like here:

      <style type="text/css">
          .rtSelected .rtIn
    {
        background-color: lime !important;
        background-image: none !important;
        color: Blue !important;
    }
        </style>
    </head>
    <body>
        <form id="form1" runat="server">
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
        </telerik:RadScriptManager>
        <div>
            <telerik:RadTreeView ID="TreeView1" runat="server">
                <Nodes>
                    <telerik:RadTreeNode Text="Arts" />
                    <telerik:RadTreeNode Text="Biographies" />
                    <telerik:RadTreeNode Text="Children's Books" />
                    <telerik:RadTreeNode Text="Cooking" />
                    <telerik:RadTreeNode Text="History" />
                    <telerik:RadTreeNode Text="Fiction" />
                    <telerik:RadTreeNode Text="Mystery" />
                    <telerik:RadTreeNode Text="Nonfiction" />
                    <telerik:RadTreeNode Text="Romance" />
                    <telerik:RadTreeNode Text="Science Fiction " />
                    <telerik:RadTreeNode Text="Travel" />
                </Nodes>
            </telerik:RadTreeView>
        </div>
        </form>
    </body>

    Regards,
    Plamen Zdravkov
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Back to Top