i'm trying to find which node is the current node, and i have 5 root node and if the user click on any of the node, i want to disable the selected node and this is something i want put on master.page page_load event
string pageName = Path.GetFileName(Page.Request.FilePath); //getting the page name
foreach (TreeNode node in TreeView2.Nodes)
{
string _NavigateURL, _pageName;
_NavigateURL = node.NavigateUrl.ToString();
_pageName = Path.GetFileName(_NavigateURL);
if (_pageName == clsConstant.pageInfo)
{
TreeView2.Nodes[1].SelectAction = TreeNodeSelectAction.None;
break;
}
note: i do not want to hard code the Node[1] <<<<<<<<----
Node[0]
node[1]
node[2]
is there a way to find in which node i'm in ?
<asp:TreeView ID="TreeView2" runat="server" Width="179px">
<Nodes>
<asp:TreeNode NavigateUrl="~/LandingPage.aspx" Text="Landing Page" Value="Landing Page"></asp:TreeNode>
<asp:TreeNode NavigateUrl="~/VisitBasicInfo.aspx" Text="Visit Basic Information" Value="Visit Basic Information"></asp:TreeNode>
<asp:TreeNode NavigateUrl="~/VisitFacilitiesInfo.aspx" Text="Visit Facilities Information" Value="Visit Facilities Information"></asp:TreeNode>
<asp:TreeNode NavigateUrl="~/VisitorsAttending.aspx" Text="Visitors Attending" Value="Visitors Attending"></asp:TreeNode>
<asp:TreeNode NavigateUrl="~/VisitHistory.aspx" Text="History" Value="History"></asp:TreeNode>
</Nodes>
<SelectedNodeStyle BackColor="#CCC" />
</asp:TreeView>
Its all about coding!