
Andy Green
Top achievements
Rank 2
Andy Green
asked on 29 Jun 2011, 09:36 PM
HI
Appologies if this has been covered, but I can't find a solution that works to my particular problem.
I have a RadMenu in a user control. This user control is in a place holder on a master page.
What I cant get to work is the menu to maintain the selected menu item when a user clicks on the menu item and the page loads.
I have enabled the EnableSelection property, but I didn't expect it to be that easy.
Andy
Appologies if this has been covered, but I can't find a solution that works to my particular problem.
I have a RadMenu in a user control. This user control is in a place holder on a master page.
What I cant get to work is the menu to maintain the selected menu item when a user clicks on the menu item and the page loads.
I have enabled the EnableSelection property, but I didn't expect it to be that easy.
Andy
6 Answers, 1 is accepted
0
Hello Andy Green,
Please take a look at the following demo where this scenario is implemented - Menu / Show Path And BreadCrumb.
Greetings,
Kate
the Telerik team
Please take a look at the following demo where this scenario is implemented - Menu / Show Path And BreadCrumb.
Greetings,
Kate
the Telerik team
Register for the Q2 2011 What’s New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!
0

Andy Green
Top achievements
Rank 2
answered on 06 Jul 2011, 11:03 AM
Thanks I have seen this,
The trouble is my RadMenu is in a user control and I can't get the right handle on it.
I know this isn't a Telerik problem, does the community have a silution?
Andy
The trouble is my RadMenu is in a user control and I can't get the right handle on it.
I know this isn't a Telerik problem, does the community have a silution?
Andy
0
Accepted
Hello Andy,
I have attached a sample master page using a user control and BreadCrumb functionality of the RadMenu. Please take a look at it and let me know if this complies with your scenario or am I missing something.
Kind regards,
Kate
the Telerik team
I have attached a sample master page using a user control and BreadCrumb functionality of the RadMenu. Please take a look at it and let me know if this complies with your scenario or am I missing something.
Kind regards,
Kate
the Telerik team
Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!
0

Raheel
Top achievements
Rank 1
answered on 12 Jul 2011, 03:34 PM
Hello Andy,
I had same problem as you defined and I solved using below steps
1) In master page add below
2) In Master page .cs file
for page load add below code
and for RadMenu1_ItemClick event add this
Hope it will solver your problem
Thanks,
I had same problem as you defined and I solved using below steps
1) In master page add below
<
telerik:RadMenu
ID
=
"RadMenu2"
runat
=
"server"
onitemclick
=
"RadMenu1_ItemClick"
Skin
=
"Black"
EnableSelection
=
"true"
CausesValidation
=
"false"
EnableRoundedCorners
=
"true"
EnableShadows
=
"true"
>
<
Items
>
<
telerik:RadMenuItem
runat
=
"server"
Text
=
"Data"
PostBack
=
"false"
>
<
Items
>
<
telerik:RadMenuItem
Text
=
"Create "
NavigateUrl
=
"Abc.aspx"
PostBack
=
"false"
/>
</
Items
>
</
telerik:RadMenuItem
>
<
telerik:RadMenuItem
runat
=
"server"
Text
=
"Data2"
PostBack
=
"false"
>
<
Items
>
<
telerik:RadMenuItem
Text
=
"Search"
NavigateUrl
=
"XYZ.aspx"
PostBack
=
"false"
/>
</
Items
>
</
telerik:RadMenuItem
>
</
Items
>
</
telerik:RadMenu
>
2) In Master page .cs file
for page load add below code
RadMenuItem currentItem = RadMenu1.FindItemByUrl(Request.Url.PathAndQuery);
if (currentItem != null)
{
currentItem.HighlightPath();
//Update the title of the
}
else
RadMenu1.Items[0].HighlightPath();
and for RadMenu1_ItemClick event add this
RadMenu1.CausesValidation = false;
foreach (RadMenuItem childItem in e.Item.Menu.GetAllItems())
{
childItem.CssClass = "";
}
RadMenuItem currentItem = (RadMenuItem)e.Item;
if (currentItem != null)
{
currentItem.HighlightPath();
}
Hope it will solver your problem
Thanks,
0

WebGeek
Top achievements
Rank 1
answered on 12 Dec 2012, 01:15 PM
I can get this example to work if I use a static radmenu, but I am trying to get it to work using a dynamic menu generated using databindings. RadMenuItem does not seem to work (it returns Null). Below is my code:
//Menu UserControl
<
telerik:RadMenu
ID
=
"menuTop"
Runat
=
"server"
DataSourceID
=
"Menu_Top"
DataFieldID
=
"ID"
DataFieldParentID
=
"Parent"
EnableAutoScroll
=
"false"
BorderStyle
=
"None"
BorderWidth
=
"0px"
EnableEmbeddedSkins
=
"false"
Skin
=
"RRPPJ"
>
<
DataBindings
>
<
telerik:RadMenuItemBinding
TextField
=
"Title"
NavigateUrlField
=
"URL"
/>
</
DataBindings
>
</
telerik:RadMenu
>
<
asp:SqlDataSource
ID
=
"Menu_Top"
runat
=
"server"
ConnectionString="<%$ ConnectionStrings:conRR %>"
SelectCommand="public_Navigation" SelectCommandType="StoredProcedure">
</
asp:SqlDataSource
>
// MasterPage
<
telerik:RadSiteMap
ID
=
"BreadCrumbSiteMap"
runat
=
"server"
Skin
=
"RRPPJ"
EnableEmbeddedSkins
=
"false"
DataTextField
=
"Text"
DataNavigateUrlField
=
"NavigateUrl"
>
<
DefaultLevelSettings
ListLayout-RepeatDirection
=
"Horizontal"
SeparatorText=">" Layout="Flow" />
</
telerik:RadSiteMap
>
//MasterPage.cs
protected void Page_Load(object sender, EventArgs e)
{
FindPath();
}
private void FindPath()
{
RadMenu menu = (RadMenu)((UserControl)FindControl("siteNavigationMenu")).FindControl("menuTop");
RadMenuItem currentItem = menu.FindItemByUrl(Request.Url.PathAndQuery);
if ((currentItem != null) && (currentItem.Text != "Home"))
{
//Select the current item and its parents
currentItem.HighlightPath();
//Populate the breadcrumb
DataBindBreadCrumbSiteMap(currentItem);
this.lblBreadCrumbWelcome.Visible = false;
}
else
{
menu.Items[0].HighlightPath();
}
}
private void DataBindBreadCrumbSiteMap(RadMenuItem currentItem)
{
List<
RadMenuItem
> breadCrumbPath = new List<
RadMenuItem
>();
while (currentItem != null)
{
breadCrumbPath.Insert(0, currentItem);
currentItem = currentItem.Owner as RadMenuItem;
}
BreadCrumbSiteMap.DataSource = breadCrumbPath;
BreadCrumbSiteMap.DataBind();
}
0
Hi,
Attached to this post you can find highlightpath functionality implemented for a RadMenu control that is databound. Please note that in order for the functionality to work as expected you will need to set a string parameter after the name of the page in the NavigateUrl. For instance below are the values that I set for my example:
Regards,
Kate
the Telerik team
Attached to this post you can find highlightpath functionality implemented for a RadMenu control that is databound. Please note that in order for the functionality to work as expected you will need to set a string parameter after the name of the page in the NavigateUrl. For instance below are the values that I set for my example:
private
DataTable CreateTestTable()
{
DataTable table =
new
DataTable();
table.Columns.Add(
"ID"
);
table.Columns.Add(
"ParentID"
);
table.Columns.Add(
"Text"
);
table.Columns.Add(
"URL"
);
table.Columns.Add(
"Tooltip"
);
table.Rows.Add(
new
string
[] {
"1"
,
null
,
"root 1"
,
"MenuUCBreadCrumbpage.aspx"
,
"root 1 tooltip"
});
table.Rows.Add(
new
string
[] {
"2"
,
null
,
"root 2"
,
"MenuUCBreadCrumbpage.aspx"
,
"root 1 tooltip"
});
table.Rows.Add(
new
string
[] {
"3"
,
"1"
,
"child 1.1"
,
"MenuUCBreadCrumbpage.aspx?Page=Forums"
,
"child 1.1 tooltip"
});
table.Rows.Add(
new
string
[] {
"4"
,
"1"
,
"child 1.2"
,
"MenuUCBreadCrumbpage.aspx?Page=Blogs"
,
"child 1.2 tooltip"
});
table.Rows.Add(
new
string
[] {
"5"
,
"1"
,
"child 1.3"
,
"MenuUCBreadCrumbpage.aspx?Page=Events"
,
"child 1.3 tooltip"
});
table.Rows.Add(
new
string
[] {
"6"
,
"5"
,
"child 1.3.1"
,
"MenuUCBreadCrumbpage.aspx?Page=Code Library"
,
"child 1.3.1 tooltip"
});
table.Rows.Add(
new
string
[] {
"7"
,
"5"
,
"child 1.3.2"
,
"MenuUCBreadCrumbpage.aspx?Page=Learning Resources"
,
"child 1.3.2 tooltip"
});
table.Rows.Add(
new
string
[] {
"8"
,
"5"
,
"child 1.3.3"
,
"MenuUCBreadCrumbpage.aspx?Page=Announcements"
,
"child 1.3.3 tooltip"
});
return
table;
}
Regards,
Kate
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.