We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

define root url in menu item

Thread ID:

Created:

Updated:

Platform:

Replies:

120497 Sep 21,2015 11:39 AM Nov 4,2015 11:28 PM ASP.NET Web Forms 17
loading
Tags: Menu
Manolo
Asked On September 21, 2015 11:39 AM

Hi,

I've this menu:

           <ej:Menu ID="menuPrincipal" runat="server" CssClass="menuPrincipal">
                    <Items>
                        <ej:MenuItem Text="Inicio" Url="~/Default.aspx" ></ej:MenuItem>
                        <ej:MenuItem Text="Control Operaciones">
                            <Items>
                                <ej:MenuItem Text="Electricidad">
                                    <Items>
                                        <ej:MenuItem Text="Informe Diario" Url="~/ControlOperaciones/Electricidad/InformeDiario.aspx"/>
                                        <ej:MenuItem Text="Informe Semanal" Url="~/ControlOperaciones/Electricidad/InformeSemanal.aspx" />
                                    </Items>
                                </ej:MenuItem>
                                <ej:MenuItem Text="Gas">
                                    <Items>
                                        <ej:MenuItem Text="Informe Diario" Url="~/ControlOperaciones/Gas/InformeDiario.aspx" />
                                        <ej:MenuItem Text="Informe Semanal" Url="~/ControlOperaciones/Gas/InformeSemanal.aspx" />
                                    </Items>
                                </ej:MenuItem>
                            </Items>
                        </ej:MenuItem>
                        <ej:MenuItem Text="Gestión Campañas"></ej:MenuItem>
                        <ej:MenuItem Text="Informes Mensuales Data G&E"></ej:MenuItem>
                        <ej:MenuItem Text="Informes Resultados Control Calidad"></ej:MenuItem>
                        <ej:MenuItem Text="Indicadores LMyO" Url="~/IndicadoresLMyO/Default.aspx"></ej:MenuItem>
                    </Items>
                </ej:Menu>

But, the urls navigation don't work, for example, if I'm in "/ControlOperaciones/Electricidad/InformeSemanal.aspx"  page, if a click on Inicio menu item I go to this page:

http://localhost:63615/ControlOperaciones/Electricidad/~/Default.aspx

How can i set the root value correctly?

Kasithangam C [Syncfusion]
Replied On September 22, 2015 05:30 AM

Hi Manolo,

On analyzing your code, we found that, there is URL path doesn’t provide properly in the menu item. This is the cause of the issue while click on menu item it doesn’t navigate to the proper page. To resolve this issue, we need to remove the symbol ~/ in the provided path url. Please find the code for the same,

<code>

<ej:Menu ID="menuPrincipal" runat="server" CssClass="menuPrincipal">

                    <Items>

                        <ej:MenuItem Text="Inicio" Url="Default.aspx" ></ej:MenuItem>

                        <ej:MenuItem Text="Control Operaciones">

                            <Items>

                                <ej:MenuItem Text="Electricidad">

                                    <Items>

                                        <ej:MenuItem Text="Informe Diario" Url="ControlOperaciones/Electricidad/InformeDiario.aspx"/>

                                        <ej:MenuItem Text="Informe Semanal" Url="ControlOperaciones/Electricidad/InformeSemanal.aspx" />

                                    </Items>

                                </ej:MenuItem>

                                <ej:MenuItem Text="Gas">

                                    <Items>

                                        <ej:MenuItem Text="Informe Diario" Url="ControlOperaciones/Gas/InformeDiario.aspx" />

                                        <ej:MenuItem Text="Informe Semanal" Url="ControlOperaciones/Gas/InformeSemanal.aspx" />

                                    </Items>

                                </ej:MenuItem>

                            </Items>

                        </ej:MenuItem>

                        <ej:MenuItem Text="Gestión Campañas"></ej:MenuItem>

                        <ej:MenuItem Text="Informes Mensuales Data G&E"></ej:MenuItem>

                        <ej:MenuItem Text="Informes Resultados Control Calidad"></ej:MenuItem>

                        <ej:MenuItem Text="Indicadores LMyO" Url="IndicadoresLMyO/Default.aspx"></ej:MenuItem>

                    </Items>

                </ej:Menu>

</code>
We have prepared the sample based on this and please refer to the following sample:

Sample: Sample

Please let us know if you have further query.                                

Regards,
Kasithangam


Manolo
Replied On September 23, 2015 10:32 AM

Hi Kasithangam,

My menu is defined on MasterPage, so, from any page, I must navigate to others.

In your example, the menu control is only in Button.aspx, but this is not my case.

When I stay, for example, in page "ControlOperaciones/Electricidad/InformeSemanal" and I want go to other page, the redirectios is wrong.

I attach other example

Attachment: SampleButton_276c7073.zip

Kasithangam C [Syncfusion]
Replied On September 24, 2015 06:35 AM

Hi Manolo,

The cause of the issue “url doesn’t navigate when render menu control in site master page” is our Menu control scripts reference path doesn’t loaded propery while click menu item to navigating other page.To resolve this issue, remove the custom scripts and css references in site master page and please add the below code in web.config file.

<code>
[Web.Config]


<appSettings>

    <add key="LoadEJResourcesFromAssembly" value="true" />

    <add key="EJResources" value="jsrender:true;jqueryeasing:true;globalize:true;themes:true;" />
  </appSettings>
</code>

While enabling LoadEJResourcesFromAssembly and EJResoures app key settings it will include our necessary script and CSS files as embedded resource from the EJ.Web assembly itself.
Also, we need to modify the URL path in menu control based on the folder structure and please find the code for same:

<code>

<ej:Menu ID="menuPrincipal" runat="server" CssClass="menuPrincipal">

                    <Items>

                        <ej:MenuItem Text="Inicio" Url="../../Default.aspx" ></ej:MenuItem>

                        <ej:MenuItem Text="Control Operaciones">

                            <Items>

                                <ej:MenuItem Text="Electricidad">

                                    <Items>

                                        <ej:MenuItem Text="Informe Diario" Url="../../ControlOperaciones/Electricidad/InformeDiario.aspx"/>

                                        <ej:MenuItem Text="Informe Semanal" Url="../../ControlOperaciones/Electricidad/InformeSemanal.aspx" />

                                    </Items>

                                </ej:MenuItem>

                                <ej:MenuItem Text="Gas">

                                    <Items>

                                        <ej:MenuItem Text="Informe Diario" Url="../../ControlOperaciones/Gas/InformeDiario.aspx" />

                                        <ej:MenuItem Text="Informe Semanal" Url="../../ControlOperaciones/Gas/InformeSemanal.aspx" />

                                    </Items>

                                </ej:MenuItem>

                            </Items>

                        </ej:MenuItem>

                        <ej:MenuItem Text="Gestión Campañas"></ej:MenuItem>

                        <ej:MenuItem Text="Informes Mensuales Data G&E"></ej:MenuItem>

                        <ej:MenuItem Text="Informes Resultados Control Calidad"></ej:MenuItem>

                        <ej:MenuItem Text="Indicadores LMyO" Url="../../IndicadoresLMyO/Default.aspx"></ej:MenuItem>

                    </Items>
                </ej:Menu>
</code>

Now, when you click on the menu item the corresponding page navigates properly.We have modified the sample based on this and please refer to the following sample:

Sample: Sample

Please let us know if you have further query.                                

Regards,

Kasithangam


Manolo
Replied On September 24, 2015 06:48 AM

Ok! Thanks a lot!

Kasithangam C [Syncfusion]
Replied On September 25, 2015 12:37 AM

Hi Manolo,
Thanks for your update. Please get back to us if you have further queries. We will be happy to help you out.

Regards,
Kasithangam


Manolo
Replied On October 23, 2015 02:04 PM

Hi again,

I've a problem when I put the project into a external server.

if I've this adress:

http://serverxxxxxx.es/WebSite_xxxxx/Default

when I want use a menu item, it redirects wrong, setting the menu item with url "../../XXXX" it redirect to similar adress:

http://serverxxxxxx.es/ControlOperaciones/Electricidad/InformeDiario.aspx

the string "WebSite_xxxx" is removed.

So.... Can I set the tag runat=server into menu items? So setting the url "~/ControlOperaciones/Electricidad/InformeDiario.aspx", I'm sure that it works fine.

Also, I will need hide or show menu items in function users profile, and I'll do it in code behind and I need set this property.


Thanks


Saranya Sivakumar [Syncfusion]
Replied On October 26, 2015 06:35 AM

Hi Manolo,

We can set the tag runat=”server” for the menu items in order to access the corresponding item in server side. So we can set runat=”server” for the menu items as shown in the following code snippet.

<code>

<ej:Menu ID="menuPrincipal" runat="server" CssClass="menuPrincipal">

                    <Items>

                        <ej:MenuItem runat="server" Text="Inicio" Url="../../Default.aspx"></ej:MenuItem>

                        <ej:MenuItem runat="server" Text="Control Operaciones">

                            <Items>

                                <ej:MenuItem runat="server"  Text="Electricidad">

                                    <Items>

                                        <ej:MenuItem runat="server"  Text="Informe Diario" Url="../../ControlOperaciones/Electricidad/InformeDiario.aspx"/>

                                        <ej:MenuItem runat="server"  Text="Informe Semanal" Url="../../ControlOperaciones/Electricidad/InformeSemanal.aspx"/>

                                    </Items>

                                </ej:MenuItem>

                    </Items>
                </ej:Menu>


</code>

Please let us know if you have any other queries.

Regards,

Saranya.S


Manolo
Replied On October 26, 2015 11:32 AM

in tag

<ej:MenuItem>

Visual Studio 2015 intellisense can not recognize tag runat="server"

And, if I set this tag and the url similar at this:

<ej:MenuItem runat="server" Text="Informe Semanal Electricidad" Url="~/ControlOperaciones/MedidasIndustriales/InformeSemanalElectricidad.aspx" />

When I click, it cannot redirect fine. The wrong redirect url:

http://localhost:55773/Administracion/ControlOperaciones/~/ControlOperaciones/MedidasIndustriales/InformeSemanalElectricidad.aspx

Saranya Sivakumar [Syncfusion]
Replied On October 28, 2015 05:56 AM

Hi Manolo,

We regret for the inconvenience caused,

You can still use runat server for the menu items even though it is not shown in intellisence. Also we suggest use to use Page.ResolveClientUrl to maintain the path accordingly. While hosting it in server it possess the corresponding path. Please refer the below code snippet for more details.

<code>

<ej:Menu ID="menuPrincipal" runat="server" CssClass="menuPrincipal">

                    <Items>

                        <ej:MenuItem Id="menuitem1" Text="Inicio" Url="<%= Page.ResolveClientUrl('~/Default.aspx')%>" ></ej:MenuItem>

                        <ej:MenuItem Text="Control Operaciones">

                            <Items>

                                <ej:MenuItem Text="Electricidad">

                                    <Items>

                                        <ej:MenuItem Text="Informe Diario" Url="<%= Page.ResolveClientUrl('~/ControlOperaciones/Electricidad/InformeDiario.aspx')%>"/>

                                        <ej:MenuItem Text="Informe Semanal" Url="<%= Page.ResolveClientUrl('~/ControlOperaciones/Electricidad/InformeSemanal.aspx')%>" />

                                    </Items>

                                </ej:MenuItem>

                                <ej:MenuItem Text="Gas">

                                    <Items>

                                        <ej:MenuItem Text="Informe Diario" Url="<%= Page.ResolveClientUrl('~/ControlOperaciones/Gas/InformeDiario.aspx')%>" />

                                        <ej:MenuItem Text="Informe Semanal" Url="<%= Page.ResolveClientUrl('~/ControlOperaciones/Gas/InformeSemanal.aspx')%>" />

                                    </Items>

                                </ej:MenuItem>

                            </Items>

                        </ej:MenuItem>

                        <ej:MenuItem Text="Gestión Campañas"></ej:MenuItem>

                        <ej:MenuItem Text="Informes Mensuales Data G&E"></ej:MenuItem>

                        <ej:MenuItem Text="Informes Resultados Control Calidad"></ej:MenuItem>

                        <ej:MenuItem Text="Indicadores LMyO" Url="<%= Page.ResolveClientUrl('~/IndicadoresLMyO/Default.aspx')%>"></ej:MenuItem>

                    </Items>

                </ej:Menu>

</code>

For your convienience we have modified the sample based on hosting in server and the same can be downloaded from the following location.

http://www.syncfusion.com/downloads/support/forum/120497/ze/MenuUrl1247599311

Kindly check with the sample. If still you face the problem then please share us the online link which you have hosted in the server. Also if possible please share us the entire sample in which we can able to reproduce the error. This will be helpful for us to serve you better.

Regards,

Saranya.S


Manolo
Replied On October 28, 2015 08:32 AM

Hi,

I upload your last attached project into a test server.

The url is:

http://www.testmenu.somee.com/website/button.aspx

If I click on first menu item, Inicio:

<ej:MenuItem Text="Inicio" Url="../../Default.aspx" ></ej:MenuItem>

it redirects into http://www.testmenu.somee.com/Default.aspx, with no website folder, so, it's wrong.

If I click on second menu, the item inicio

<ej:MenuItem Id="menuitem1" Text="Inicio" Url="<%= Page.ResolveClientUrl('~/Default.aspx')%>" ></ej:MenuItem>

It also redirects wrong

http://www.testmenu.somee.com/website/%3C%=%20Page.ResolveClientUrl%28'~/Default.aspx'%29%%3E

if you need the user and passworsd say me.

Thanks



Saranya Sivakumar [Syncfusion]
Replied On October 29, 2015 01:52 PM

Hi Manolo,

We would like to let you know that, we have to specify the URL path according to your folder structure to which the Menu item should get navigated. In your update we have found that you are having a folder named “website” and you have been navigating to it. So you have to mention the URL as shown in the following code snippet.

<code>

<ej:Menu ID="menuPrincipal" runat="server" CssClass="menuPrincipal">

                    <Items>

                        <ej:MenuItem Id="menuitem1" Text="Inicio" Url="<%= Page.ResolveClientUrl('~/website/Default.aspx')%>" ></ej:MenuItem>

                        <ej:MenuItem Text="Control Operaciones"></ej:MenuItem>

                     <%-- Your Menu Items Here --%>

</Items>

 </ej:Menu>


</code>

So Kindly set the path according to your folder structure. If still you face the problem then please share us your hosted sample along with the folder structure and share us your username and password. This will be helpful for us to serve you better.

Regards,

Saranya.S


Manolo
Replied On October 30, 2015 04:05 AM

Sorry, I can't set the url path fine.

In this page:

https://somee.com/default.aspx

in control panel I put the project.

For access

user: manolocapdevila
password: Syncfusion123

Inside, in managed products ->WebSites ->TestMenu.Somee.com ->Applications there is a file explorer with a folder WebSite and inside there is the test project.



Thanks

Muralishankar Sundaram [Syncfusion]
Replied On November 3, 2015 08:44 AM

 Hi Manola,

Thanks for your update,

In order to solve the url navigation issue, We suggest you to use the Page.ResolveClientUrl() method in the code-behind. Please find the sample code snippet bellow:

<code>
[ASPX]

<ej:Menu ID="menuPrincipal" runat="server" CssClass="menuPrincipal">

                    <Items>

                        <ej:MenuItem Text="Inicio" Url="~/Default.aspx" ></ej:MenuItem>

                        <ej:MenuItem Text="Control Operaciones">

                            <Items>

                                <ej:MenuItem Text="Electricidad">

                                    <Items>

                                        <ej:MenuItem Text="Informe Diario" Url="~/ControlOperaciones/Electricidad/InformeDiario.aspx"/>

                                        <ej:MenuItem Text="Informe Semanal" Url="~/ControlOperaciones/Electricidad/InformeSemanal.aspx" />

                                    </Items>

                                </ej:MenuItem>

                                <ej:MenuItem Text="Gas">

                                    <Items>

                                        <ej:MenuItem Text="Informe Diario" Url="~/ControlOperaciones/Gas/InformeDiario.aspx" />

                                        <ej:MenuItem Text="Informe Semanal" Url="~/ControlOperaciones/Gas/InformeSemanal.aspx" />

                                    </Items>

                                </ej:MenuItem>

                            </Items>

                        </ej:MenuItem>

                        <ej:MenuItem Text="Gestión Campañas"></ej:MenuItem>

                        <ej:MenuItem Text="Informes Mensuales Data G&E"></ej:MenuItem>

                        <ej:MenuItem Text="Informes Resultados Control Calidad"></ej:MenuItem>

                        <ej:MenuItem Text="Indicadores LMyO" Url="~/IndicadoresLMyO/Default.aspx"></ej:MenuItem>

                    </Items>
                </ej:Menu>

[cs]

protected void Page_Load(object sender, EventArgs e)

        {

            for (int index = 0; index < menuPrincipal.Items.Count; index++)

            {

                if (!string.IsNullOrEmpty(menuPrincipal.Items[index].Url))

                    menuPrincipal.Items[index].Url = Page.ResolveClientUrl(menuPrincipal.Items[index].Url);

                for (int index1 = 0; index1 < menuPrincipal.Items[index].Items.Count; index1++)

                {

                    if (!string.IsNullOrEmpty(menuPrincipal.Items[index].Items[index1].Url))

                        menuPrincipal.Items[index].Items[index1].Url = Page.ResolveClientUrl(menuPrincipal.Items[index].Items[index1].Url);

                    for (int index2 = 0; index2 < menuPrincipal.Items[index].Items[index1].Items.Count; index2++)

                    {

                        if (!string.IsNullOrEmpty(menuPrincipal.Items[index].Items[index1].Items[index2].Url))

                            menuPrincipal.Items[index].Items[index1].Items[index2].Url = Page.ResolveClientUrl(menuPrincipal.Items[index].Items[index1].Items[index2].Url);

                    }

                }


            }

               
        }
</code>

We have prepared the Menu –URL navigation sample and its available in a below link:
http://www.syncfusion.com/downloads/support/forum/120497/ze/Sample_Menu1524654363


Please let us know if you have any other queries.

Regards,
Muralishankar


Manolo
Replied On November 3, 2015 09:12 AM

Hi,

Thanks for your update!

but another question, is possible fix this in a future update?

Thank you again!

Ezhil S [Syncfusion]
Replied On November 4, 2015 06:02 AM

Hi Manola,

We have logged defect report regarding the Menu control Url property. A support incident to track the status of this defect has been created under your account. Please log on to our support website to check for further updates

https://www.syncfusion.com/account/login?ReturnUrl=%2fsupport%2fdirecttrac%2fincidents

Please let us know if you have any questions.

Best,
Ezhil S

Manolo
Replied On November 4, 2015 06:03 AM

Ok,

Thanks a lot!

Arun Palaniyandi [Syncfusion]
Replied On November 4, 2015 11:28 PM

Hi Manola,

Thanks for your update.

We are glad that provided solution helped you to resolve the issue at your end. 

Let us know if you need further assistance.

Regards,
Arun P

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;