Hi guys. I'm using an asp.menu control and i populate it with a site.map file in my project. The thing is, i'm trying to add a submenu in it. But even the parent node isn't showing up. Its itemdatabound event isn't even fired. Any ideas what's going on?
My web.sitemap. The submenu would be "Relatórios".
<?xml version="1.0" encoding="utf-8" ?>
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
<siteMapNode url="formPaginaPrincipal.aspx" title="Página Inicial" description="Pagina inicial do site">
<siteMapNode url="listaModalidades.aspx" title="Modalidades" description="Modalidades de licitações" />
<siteMapNode url="listaTiposLicitacao.aspx" title="Tipos de Licitação" description="Tipos de licitações" />
<siteMapNode url="listaOrgaos.aspx" title="Órgãos" description="Órgãos do governo de Pernambuco" />
<siteMapNode url="listaComissoes.aspx" title="Comissões" description="Comissões de licitações" />
<siteMapNode url="listaLicitacoes.aspx" title="Licitações" description="Licitações" />
<siteMapNode url="ArquivarLicitacoes.aspx" title="Arquivar Licitações" description="Arquivamento de Licitações" />
<siteMapNode url="listaEmpresas.aspx" title="Fornecedores" description="Fornecedores" />
<siteMapNode url="listaUsuarios.aspx" title="Usuários" description="Usuários de Órgãos do governo de Pernambuco" />
<siteMapNode title="Relatórios" description="Relatórios">
<siteMapNode title="Relatórios Gerenciais" description="Relatórios Gerenciais" url="listaRelatorios.aspx">
</siteMapNode>
</siteMapNode>
<siteMapNode url="formPaginaPrincipal.aspx?acao=sair" title="Sair" description="Encerrar Sessão" />
</siteMapNode>
</siteMap>
I am not sure whether I have understood your meaning correctly. If I am wrong, please feel free to contact me. The reason why the parent node Página Inicial is not showing up is that you have setted ShowStartingNode as "false". This is used to indicate
whether the starting node is retrieved and displayed. If you want to show it, please set the ShowStartingNode as "true".
Skeith
Its itemdatabound event isn't even fired.
It should work. Please check the demo below which uses Response.Write(e.Item.Text) method to show the text of every item:
Well, saw the aspx file in design mode and i saw that the parent node and its child node appears in the menu. But when i run the project, they don't show up...
Skeith
Member
65 Points
74 Posts
problem with site.map and asp.menu (Sub Menu) (RESOLVED)
Aug 03, 2012 12:20 PM|LINK
Hi guys. I'm using an asp.menu control and i populate it with a site.map file in my project. The thing is, i'm trying to add a submenu in it. But even the parent node isn't showing up. Its itemdatabound event isn't even fired. Any ideas what's going on?
My web.sitemap. The submenu would be "Relatórios".
<?xml version="1.0" encoding="utf-8" ?> <siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" > <siteMapNode url="formPaginaPrincipal.aspx" title="Página Inicial" description="Pagina inicial do site"> <siteMapNode url="listaModalidades.aspx" title="Modalidades" description="Modalidades de licitações" /> <siteMapNode url="listaTiposLicitacao.aspx" title="Tipos de Licitação" description="Tipos de licitações" /> <siteMapNode url="listaOrgaos.aspx" title="Órgãos" description="Órgãos do governo de Pernambuco" /> <siteMapNode url="listaComissoes.aspx" title="Comissões" description="Comissões de licitações" /> <siteMapNode url="listaLicitacoes.aspx" title="Licitações" description="Licitações" /> <siteMapNode url="ArquivarLicitacoes.aspx" title="Arquivar Licitações" description="Arquivamento de Licitações" /> <siteMapNode url="listaEmpresas.aspx" title="Fornecedores" description="Fornecedores" /> <siteMapNode url="listaUsuarios.aspx" title="Usuários" description="Usuários de Órgãos do governo de Pernambuco" /> <siteMapNode title="Relatórios" description="Relatórios"> <siteMapNode title="Relatórios Gerenciais" description="Relatórios Gerenciais" url="listaRelatorios.aspx"> </siteMapNode> </siteMapNode> <siteMapNode url="formPaginaPrincipal.aspx?acao=sair" title="Sair" description="Encerrar Sessão" /> </siteMapNode> </siteMap>My asp:menu and asp:sitemapdatasource:
<asp:Menu ID="mnuPrincipal" runat="server" DataSourceID="SiteMapDataSource1" StaticDisplayLevels="2" Width="208px" onmenuitemclick="mnuPrincipal_MenuItemClick" OnMenuItemDataBound="mnuPrincipal_temDataBound" DynamicHorizontalOffset="2" StaticSubMenuIndent="40px" > <StaticMenuStyle CssClass="menu" /> <StaticSelectedStyle CssClass="selecionado" /> <StaticMenuItemStyle CssClass="sub-menu" /> <DynamicMenuStyle CssClass="menu" /> <DynamicSelectedStyle CssClass="selecionado" /> <DynamicMenuItemStyle CssClass="sub-menu" /> </asp:Menu> <asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" ShowStartingNode="false" />Rajesh Sawan...
Participant
1612 Points
246 Posts
Re: problem with site.map and asp.menu (Sub Menu) (RESOLVED)
Aug 07, 2012 11:45 AM|LINK
Hi
for the attribute on your SiteMapDataSource.Pleas try to implent as shown below:-
Set
See whether its working for you.
</div>//Happy Coding
Regards,
RajeshS.
Skeith
Member
65 Points
74 Posts
Re: problem with site.map and asp.menu (Sub Menu) (RESOLVED)
Aug 07, 2012 12:37 PM|LINK
It does not work. The parent node and the child node(s) doesn't appear on the menu. If i remove the child node, it works...
Catherine Sh...
All-Star
23382 Points
2490 Posts
Microsoft
Re: problem with site.map and asp.menu (Sub Menu) (RESOLVED)
Aug 09, 2012 02:24 AM|LINK
Hi,
I am not sure whether I have understood your meaning correctly. If I am wrong, please feel free to contact me. The reason why the parent node Página Inicial is not showing up is that you have setted ShowStartingNode as "false". This is used to indicate whether the starting node is retrieved and displayed. If you want to show it, please set the ShowStartingNode as "true".
It should work. Please check the demo below which uses Response.Write(e.Item.Text) method to show the text of every item:
In the .aspx
<asp:Menu ID="Menu1" runat="server" DataSourceID="SiteMapDataSource1" StaticDisplayLevels="2" Width="208px" DynamicHorizontalOffset="2" StaticSubMenuIndent="40px" OnMenuItemDataBound="Menu1_MenuItemDataBound" > <StaticMenuStyle CssClass="menu" /> <StaticSelectedStyle CssClass="selecionado" /> <StaticMenuItemStyle CssClass="sub-menu" /> <DynamicMenuStyle CssClass="menu" /> <DynamicSelectedStyle CssClass="selecionado" /> <DynamicMenuItemStyle CssClass="sub-menu" /> </asp:Menu> <asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" ShowStartingNode="true" />In the .cs
protected void Menu1_MenuItemDataBound(object sender, MenuEventArgs e) { Response.Write(e.Item.Text); }Best wishes,
Feedback to us
Develop and promote your apps in Windows Store
Skeith
Member
65 Points
74 Posts
Re: problem with site.map and asp.menu (Sub Menu) (RESOLVED)
Aug 09, 2012 12:44 PM|LINK
Hello Catherine. Thanks for your reply.
Here's what's happening: I've added a sitemapnode in the web.sitemap file that has a child node.
When i run the project, the parent node and its child node doesn't appear in the menu..it was supposed to go like this:
parent node1
parent node2
---child node 2.1
parent node 3
but it's going like this instead:
parent node1
parent node 3
and so it goes (assuming the node i've added was parent node 2).
I've tried setting showstartingnode = true but nothing has changed...
Catherine Sh...
All-Star
23382 Points
2490 Posts
Microsoft
Re: problem with site.map and asp.menu (Sub Menu) (RESOLVED)
Aug 10, 2012 07:34 AM|LINK
Hi,
Have you tried the code I provided? I have tested it locally and find out that it works well as you expects below.
Feedback to us
Develop and promote your apps in Windows Store
Skeith
Member
65 Points
74 Posts
Re: problem with site.map and asp.menu (Sub Menu) (RESOLVED)
Aug 10, 2012 11:06 AM|LINK
I've tried your code Catherine, but i've tried it inside a master page.
Could this be the reason why it's not working?
Skeith
Member
65 Points
74 Posts
Re: problem with site.map and asp.menu (Sub Menu) (RESOLVED)
Aug 10, 2012 11:32 AM|LINK
Well, saw the aspx file in design mode and i saw that the parent node and its child node appears in the menu. But when i run the project, they don't show up...
Skeith
Member
65 Points
74 Posts
Re: problem with site.map and asp.menu (Sub Menu) (RESOLVED)
Aug 10, 2012 06:24 PM|LINK
I've found what was wrong. Since the parent node didn't have any value in its url property, it wouldn't show up in the menu.
Thanks for the help guys!