Hi All,
I am using Telerik RadTreeview control for the navigation purpose in DotNetNuke (DNN) custom module. Below is the look and feel of the RadTreeview control on my portal and RadTreeview control displayed on each and every page of the portal.
First time when ever page get loaded its display as below though Page 2 and Page 5 contains sub-pages
Page 1
Page 2
Page 3
Page 4
Page 5
What I want is if I click on Page 2.1 then it will redirect to page Page 2.1 (which is working fine) and the RadTreeview control will display as below on page Page 2.1.
Page 1
Page 2
Page 2.1
Page 2.2
Page 3
Page 4
Page 5
After that if I click on Page 5.2 then it will redirect to page Page 5.2 (which is working fine) and the RadTreeview control will display as below on page Page 5.2.
Page 1
Page 2
Page 3
Page 4
Page 5
Page 5.1
Page 5.2
After that if I click on Page 4 then it will redirect to page Page 4 (which is working fine) and the RadTreeview control will display as below on page Page 4.
Page 1
Page 2
Page 3
Page 4
Page 5
I mean the selected page's parent should be in expand mode and the selected page should be highlighted.
Kindly let me know how we can achieve this functionality through programmatically.
Below is the code what I have with me right now.
.ASCX Code
I am using Telerik RadTreeview control for the navigation purpose in DotNetNuke (DNN) custom module. Below is the look and feel of the RadTreeview control on my portal and RadTreeview control displayed on each and every page of the portal.
First time when ever page get loaded its display as below though Page 2 and Page 5 contains sub-pages
Page 1
Page 2
Page 3
Page 4
Page 5
What I want is if I click on Page 2.1 then it will redirect to page Page 2.1 (which is working fine) and the RadTreeview control will display as below on page Page 2.1.
Page 1
Page 2
Page 2.1
Page 2.2
Page 3
Page 4
Page 5
After that if I click on Page 5.2 then it will redirect to page Page 5.2 (which is working fine) and the RadTreeview control will display as below on page Page 5.2.
Page 1
Page 2
Page 3
Page 4
Page 5
Page 5.1
Page 5.2
After that if I click on Page 4 then it will redirect to page Page 4 (which is working fine) and the RadTreeview control will display as below on page Page 4.
Page 1
Page 2
Page 3
Page 4
Page 5
I mean the selected page's parent should be in expand mode and the selected page should be highlighted.
Kindly let me know how we can achieve this functionality through programmatically.
Below is the code what I have with me right now.
.ASCX Code
<
telerik:RadTreeView
ID
=
"RadTreeView1"
runat
=
"server"
OnNodeClick
=
"RadTreeView1_NodeClick"
Skin
=
"NGR"
EnableEmbeddedSkins
=
"false"
ShowLineImages
=
"false"
>
<
databindings
>
<
telerik:RadTreeNodeBinding
Expanded
=
"False"
></
telerik:RadTreeNodeBinding
>
</
databindings
>
</
telerik:RadTreeView
>
C# Code
protected
void
Page_Load(
object
sender, EventArgs e)
{
if
(!Page.IsPostBack)
{
BindLeftNavigation(RadTreeView1);
}
}
private
void
BindLeftNavigation(RadTreeView treeView)
{
MenuController objController =
new
MenuController();
DataSet ds =
new
DataSet();
ds = objController.Get_Menu(
this
.PortalId);
if
(ds.Tables[0].Rows.Count > 0)
{
treeView.DataSource = ds;
treeView.DataTextField =
"TabName"
;
treeView.DataValueField =
"TabID"
;
treeView.DataNavigateUrlField =
""
;
treeView.DataFieldID =
"TabID"
;
treeView.DataFieldParentID =
"ParentID"
;
treeView.DataBind();
}
}
protected
void
RadTreeView1_NodeClick(
object
sender, RadTreeNodeEventArgs e)
{
Response.Redirect(DotNetNuke.Common.Globals.NavigateURL(Convert.ToInt32(e.Node.Value.ToString())));
}