Click here to Skip to main content
15,892,298 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
hai everybody

i am using a tree view in asp.net 2.0

+Root
+parent
+leaf
+leaf
i want to remove root from that,i have bind the tree view through database

code behind is below

XML
<asp:TreeView ID="trvModules" runat="server" style="font-weight: 700" ShowCheckBoxes="All" 
ExpandDepth="0" 

PopulateNodesFromClient="true" EnableViewState="False" onselectednodechanged="trvModules_SelectedNodeChanged"
>



cs:
C#
dataset ds_modright=ff.filltree();
for (int i = 0; i < ds_modright.Tables[0].Rows.Count; i++)
{
TreeNode PNode = new TreeNode();
PNode = new TreeNode(ds_modright.Tables[0].Rows[i]["Module_Name"].ToString(), ds_modright.Tables[0].Rows[i]["Mod_Id"].ToString());

trvModules.Nodes.Add(PNode);
}




i wantosee my treeview like

+parent
+leaf
+leaf


please help me its urgent
Posted
Updated 14-Feb-11 18:46pm
v2

Hi,

I think you can do by adding style sheet to Root Node.
Add the cssClass to RootNode and make display as none.
Then root node of treenode will be hidden.
creat cssClass name as hideRoot.

Add following code to your treenode.

C#
sampletree.RootNodeStyle.CssClass="hideRoot";


CSS
<style>
.hideRoot
{
    display:none;
}
<style></style></style>


Regards,
Kiran.
 
Share this answer
 
v3
Hope this[^] might help you.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900