Hello.
I'm using Telerik ASP.NET Control 2010 Q2. I have a RadMenu created from SiteMap, but, every time when i click on an item, when the page load, the item remains selected, as if to show me the link where I am. How can disable this??
ASPX Menu Code
SiteMap Code
Item Events Code:
JavaScript - Close on click code:
Thanks for your answer.
I'm using Telerik ASP.NET Control 2010 Q2. I have a RadMenu created from SiteMap, but, every time when i click on an item, when the page load, the item remains selected, as if to show me the link where I am. How can disable this??
ASPX Menu Code
<
telerik:RadMenu
ID
=
"rmnuMainMenu"
DataSourceID
=
"smdsMenuSource"
OnClientItemClicked
=
"OnClientItemClicked"
Width
=
"100%"
runat
=
"server"
OnItemDataBound
=
"rmnuMainMenu_ItemDataBound"
OnItemClick
=
"rmnuMainMenu_ItemClick"
/>
<
asp:SiteMapDataSource
ID
=
"smdsMenuSource"
ShowStartingNode
=
"false"
runat
=
"server"
/>
SiteMap Code
<?
xml
version
=
"1.0"
encoding
=
"utf-8"
?>
<
siteMap
xmlns
=
"http://schemas.microsoft.com/AspNet/SiteMap-File-1.0"
enableLocalization
=
"true"
>
<
siteMapNode
url
=
""
title
=
"Inicio"
>
<
siteMapNode
url
=
""
title
=
"$Resources:Localization, mnuCatalogs"
>
<
siteMapNode
url
=
"~/CatMaterials.aspx"
title
=
"$Resources:Localization, mnuMaterials"
/>
<
siteMapNode
url
=
"~/CatTrains.aspx"
title
=
"$Resources:Localization, mnuTrains"
/>
<
siteMapNode
url
=
"~/CatBatchSizes.aspx"
title
=
"$Resources:Localization, mnuBatchSizes"
/>
<
siteMapNode
url
=
""
title
=
"$Resources:Localization, mnuFC"
/>
<
siteMapNode
url
=
""
title
=
"$Resources:Localization, mnuMI"
/>
<
siteMapNode
url
=
""
title
=
"$Resources:Localization, mnuBPR"
/>
</
siteMapNode
>
<
siteMapNode
url
=
""
title
=
"$Resources:Localization, mnuPreferences"
>
<
siteMapNode
url
=
""
title
=
"$Resources:Localization, mnuLanguage"
>
<
siteMapNode
url
=
""
image
=
"../Img/mxFlag.png"
title
=
"$Resources:Localization, mnuSpanish"
/>
<
siteMapNode
url
=
""
image
=
"../Img/usFlag.png"
title
=
"$Resources:Localization, mnuEnglish"
/>
</
siteMapNode
>
<
siteMapNode
url
=
"~/UsersAdmin.aspx"
title
=
"$Resources:Localization, mnuUsers"
/>
</
siteMapNode
>
<
siteMapNode
url
=
""
title
=
"$Resources:Localization, mnuHelp"
>
<
siteMapNode
url
=
""
title
=
"$Resources:Localization, mnuContents"
/>
<
siteMapNode
url
=
""
title
=
"$Resources:Localization, mnuAbout"
/>
</
siteMapNode
>
</
siteMapNode
>
</
siteMap
>
Item Events Code:
protected
void
rmnuMainMenu_ItemClick(
object
sender, Telerik.Web.UI.RadMenuEventArgs e)
{
// Store requested language as new culture in the session
if
(e.Item.Text ==
"Español"
|| e.Item.Text ==
"Spanish"
)
Session[
"SelectedCulture"
] =
"es-MX"
;
if
(e.Item.Text ==
"Inglés"
|| e.Item.Text ==
"English"
)
Session[
"SelectedCulture"
] =
"en-US"
;
// Reload last requested page with new culture
Server.Transfer(Request.Path);
}
protected
void
rmnuMainMenu_ItemDataBound(
object
sender, Telerik.Web.UI.RadMenuEventArgs e)
{
// Load the specific image for every menu item, from the Sitemap information
e.Item.ImageUrl = ((SiteMapNode)e.Item.DataItem)[
"image"
];
if
(e.Item.Level == 0)
{
RadMenuItem separator =
new
RadMenuItem();
separator.IsSeparator =
true
;
separator.Text =
"|"
;
e.Item.Owner.Items.Insert(e.Item.Index + 1, separator);
}
}
JavaScript - Close on click code:
<script type=
"text/javascript"
>
// Close RadMenu after click
function
OnClientItemClicked(sender, eventArgs) {
sender.close();
}
</script>
Thanks for your answer.