Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
hi.i wanna do a navigation menu with asp.net usercontrol.how can i use umbraco xml library? somthing like this ?
Hi Onur,
You could use "umbraco.presentation.nodeFactory" to get all Nodes and display in a Repeater. I haven't tested this but you can get some idea from below code.
protected void Page_Load(object sender, EventArgs e)
{
// Get currentpage
Node topPage = Node.GetCurrent();
// Go to level 1 as top level menu
while (topPage.Parent != null)
topPage = topPage.Parent;
}
RepeaterTopLevelMenu.DataSource = topPage.ChildrenAsTable();
RepeaterTopLevelMenu.DataBind();
ASCX
<asp:Repeater ID="RepeaterTopLevelMenu" runat="server">
<ItemTemplate>
<li>
<a href="<%#umbraco.library.NiceUrl(int.Parse(Eval("Id").ToString())) %>">
<%#Eval("NodeName") %>
</a>
</li>
</ItemTemplate>
<HeaderTemplate>
<ul id="navi">
</HeaderTemplate>
<FooterTemplate>
</ul>
</FooterTemplate>
</asp:Repeater>
Hope this helps,
Sahan
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
navigation menu with asp.net user control
hi.i wanna do a navigation menu with asp.net usercontrol.how can i use umbraco xml library? somthing like this ?
Hi Onur,
You could use "umbraco.presentation.nodeFactory" to get all Nodes and display in a Repeater. I haven't tested this but you can get some idea from below code.
ASCX
<asp:Repeater ID="RepeaterTopLevelMenu" runat="server">
Hope this helps,
Sahan
is working on a reply...