Need Help:How to get the pageid on click of a menu item?

Need Help:How to get the pageid on click of a menu item?

Member since: 2009
 

 I am using a MenuList to generate a menu.menu consists of pages like HOME,CONTACT,ABOUT US,CAREER etc.

Now I need to get the  pageid of that corresponding page on click of a menu item.

How to get the pageid of that corresponding pagelink ? pls Help. Thanks in Advance.

Menu.ascx

****************************************************

<%@ Control Language="C#" EnableViewState="false" AutoEventWireup="False" CodeBehind="Menu.ascx.cs"    Inherits="Templates.Public.Units.Static.Menu" %>

<EPiServer:MenuList runat="server" ID="Menu">  
    <ItemTemplate>      
            <EPiServer:Property PropertyName="PageLink" runat="server" />
    </ItemTemplate>  
</EPiServer:MenuList>

****************************************************

 C#

****************************************************

  protected override void OnLoad(System.EventArgs e)
        {
            base.OnLoad(e);
            Menu.PageLink = EPiServer.Core.PageReference.StartPage;            
        }

#30774 Jun 19, 2009 12:47
  •  

    Not sure if i understand what you are asking for, but you can get the pageID from a pagelist frontend like this:

    <%#Container.CurrentPage.PageLink.ID%>

     and from backend you always have this:

     page.PageLink.ID.

     -Kjetil Simensen

    #30776 Jun 19, 2009 16:05
  • Member since: 2009
     
    He means that he'd like to click on "contact us" and get the page ID of "28" from contact us' link. He'd then programmatically like to use that elsewhere.
    #30845 Jun 24, 2009 14:11