menu with resx files

Last post 06-19-2009 10:46 AM by chintanpshah. 11 replies.

Sort Posts:

  • menu with resx files

    06-16-2009, 9:59 AM

    Hi,
    I'm making a multi language website.
    My problem appears while trying to work with menu +resx files:
    I want each menuItem's navigateUrl to have the appropriate link
    according to the page's language. So I tried to write in the page's
    resx file:
    MenuItemResource1.href   -->   ~/pageURL?ln=en
    But it doesn't work. It seems that he does not recognize this link.
    I don't get an error, it's just that the menuItem doesn't get this link.
    Help somebody.... Thanks.

  • Re: menu with resx files

    06-16-2009, 12:18 PM
    • Star
      10,594 point Star
    • chintanpshah
    • Member since 11-19-2008, 5:39 AM
    • Ahmedabad
    • Posts 1,902

    It seems that you are using HTML control (as you are using MenuItemResource1.href)

    HTML control cannot interprete ~ (relative path)

    Use:  MenuItemResource1.href = 'pageURL?ln=en';

    Or If you want to assign relative path use asp:HyperLink:

    Hyperlink1.NavigateUrl = "~/pageURL?ln=en";

    Hope this helps...

    Don't forget to mark as answer, if it helps
  • Re: menu with resx files

    06-16-2009, 1:49 PM

    Well, about your first suggestion, I tried this :
    MenuItemResource1.href       ->     http://www.google.co.il 
    but it also didn't work. He is ignoring from it.
    About your second suggestion, I want to use the asp:menu, which includes
    menuItems and not asp:hyperlink, although if I used hyperlink it would probably
    fix the problem but I can't use it.

  • Re: menu with resx files

    06-16-2009, 1:57 PM
    • Star
      10,594 point Star
    • chintanpshah
    • Member since 11-19-2008, 5:39 AM
    • Ahmedabad
    • Posts 1,902
    Can you post your Menu HTML here?
    Hope this helps...

    Don't forget to mark as answer, if it helps
  • Re: menu with resx files

    06-17-2009, 7:27 AM

    Here is my menu:

    <asp:Menu ID="MainMenu" runat="server" Orientation="Horizontal" meta:resourcekey="MainMenuResource1" Width="600px">
        <Items>
             <asp:MenuItem Text="About" Value="About" meta:resourcekey="MenuItemResource4">
                  
    <asp:MenuItem Text="Who we are" runat="server" Value="Who we are"              
                                 NavigateUrl
    ="~/WebForms/about.aspx"
                                  
    meta:resourcekey="MenuItemResource1">
                  </
    asp:MenuItem>

    And so on......

    The relevant row in the resource file is:

    MenuItemResource1.href         <------>       ~/WebForms/about.aspx?ln=en

     

    Thanks a lot for your trying and for any other help,

    Moshi. 
     

  • Re: menu with resx files

    06-17-2009, 1:31 PM
    • Star
      10,594 point Star
    • chintanpshah
    • Member since 11-19-2008, 5:39 AM
    • Ahmedabad
    • Posts 1,902

    moshicn@gmail.com:
    The relevant row in the resource file is:

    MenuItemResource1.href         <------>       ~/WebForms/about.aspx?ln=en
     

    Shouldn't It be 

    MenuItemResource1.NavigateUrl         <------>       ~/WebForms/about.aspx?ln=en

    instead of 

    MenuItemResource1.href         <------>       ~/WebForms/about.aspx?ln=en

    Hope this helps...

    Don't forget to mark as answer, if it helps
  • Re: menu with resx files

    06-18-2009, 4:32 AM

    No, I tried it before,and now again and it doesn't work:

    MenuItemResource1.NavigateUrl         <--->           ~/WebForms/about.aspx?ln=en 

    desparate...... :-(

  • if anyone could help...

    06-18-2009, 7:36 AM

    if anyone could help, or even give any clue...

    I really don't know what to do

  • Re: if anyone could help...

    06-18-2009, 2:27 PM
    • Star
      10,594 point Star
    • chintanpshah
    • Member since 11-19-2008, 5:39 AM
    • Ahmedabad
    • Posts 1,902

    I think that you can assign only Text and ToolTip property to HyperLink from Resource file.

    NavigateUrl must be set in HTML code. Like:

    <asp:HyperLink ID="lnk" runat="server" NavigateUrl="~/Default.aspx"
        meta:resourcekey="lnkResource1"></asp:HyperLink>

    Hope this helps...

    Don't forget to mark as answer, if it helps
  • Re: if anyone could help...

    06-19-2009, 7:21 AM
    OK, so what would you do if you have an asp:menu in your page, and have to give the menu items a different url according to the language ? I do give them different titles according to the language, using properties like Text... but how can I give them different urls according to the different language each time ?
  • Re: if anyone could help...

    06-19-2009, 10:39 AM
    Answer
    • Member
      80 point Member
    • ultraman69
    • Member since 05-29-2003, 1:00 PM
    • Quebec, Canada
    • Posts 30

    For my part, I added the menu items programatically in the codebihind and switch on the Thread.CurrentThread.CurrentUICulture.Name :

    switch (Thread.CurrentThread.CurrentUICulture.Name)
    {
       case "en-CA":
           //add your menu item here
       break;
    }

     

     

     

     

    _________________________________________

    Ultraman69
  • Re: if anyone could help...

    06-19-2009, 10:46 AM
    Answer
    • Star
      10,594 point Star
    • chintanpshah
    • Member since 11-19-2008, 5:39 AM
    • Ahmedabad
    • Posts 1,902

    You must dynamically created by detecting current culture.

    Hope this helps...

    Don't forget to mark as answer, if it helps
Page 1 of 1 (12 items)