This is a migrated thread and some comments may be shown as answers.

Item clicked always selected

6 Answers 118 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Felipe de Jesús
Top achievements
Rank 1
Felipe de Jesús asked on 20 Apr 2011, 05:37 PM
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
<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.

6 Answers, 1 is accepted

Sort by
0
Helen
Telerik team
answered on 26 Apr 2011, 01:52 PM
Hi Felipe,

We tried to reproduce the problem, but without much success. Please see attached our test project.
Does it work at your side? If yes - could you please modify it so we can see the problem locally?

Regards,
Helen
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

0
Felipe de Jesús
Top achievements
Rank 1
answered on 27 Apr 2011, 12:09 AM
Thanks for you time and you answer. Unfortunately, i continue with the problem, and i'm short in time to conclude my project. I hope to solve this issue later.

Thank you very much.
0
Felipe de Jesús
Top achievements
Rank 1
answered on 11 May 2011, 05:16 PM
Hello again.

An apology for all this time I could not communicate.

I send you a modified version of the test project that you sent me, with the specific problem.:

<Admin: link is removed. Please do not post links to projects that contain developer version of the controls. >

For more details, i'm using Windows XP SP3, Visual Studio 2008 SP1, .NET v3.5, and Telerik ASP.NET AJAX Controls v2010.2.713.35

I appreciate your time and attention. I look forward to your response.

Regards,
Felipe de Jesús Meléndez
0
Accepted
Helen
Telerik team
answered on 12 May 2011, 04:53 PM
Hello Felipe de Jesús,

Thank you for the provided files.
Actually this is the expected behaviour when the SiteMap DataSource is used.
The only thing I may suggest you is to populate the RadMenu from a .xml file. Please find attached the modified project.

p.s: I've edited your previous post.

Regards,
Helen
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

0
Felipe de Jesús
Top achievements
Rank 1
answered on 12 May 2011, 09:38 PM
Hello Helen.

Thanks you so much for your response. And my apologies for posting a project with the dll of the controls. Immediately when I saw your response, I deleted the file from the server.

Only another question. I trying your solution, but now the problem it´s that in the menu don't show the localized strings, only the references.

For example:

Resources:Localization, mnuCatalogs

But don't worry about that, if i can't correct it, i build the menu manually.

Thanks for your time and your answers.

Have a nice day.
0
Helen
Telerik team
answered on 13 May 2011, 01:57 PM
Hi Felipe de Jesús,

I didn't find any resource file in the project you have uploaded previously.
Please find it attached. Am I missing something?

Regards,
Helen
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Tags
Menu
Asked by
Felipe de Jesús
Top achievements
Rank 1
Answers by
Helen
Telerik team
Felipe de Jesús
Top achievements
Rank 1
Share this question
or