newbie: a ContentPlaceHolder question here

Discussion in 'ASP .Net' started by Jeff, Jul 23, 2006.

  1. Jeff

    Jeff Guest

    hey 2.0

    I have a ContentPlaceHolder control in my master page. I need a way to
    determine during runtime what is the name of the page being shown in the

    I ask because if the page shown in the ContentPlaceHolder is "Result.aspx"
    then I should programmatically add some extra menu items to the menu in the
    master page..

    Originally I thought I could use the Control.ID to determine the name of the
    page. But I think that is not the correct approach:
    System.Web.UI.ControlCollection cl = content.Controls;
    foreach (System.Web.UI.Control c in cl)
    if (c.ID == "Result.aspx") {

    Any suggestions?

    Jeff, Jul 23, 2006
    1. Advertisements

  2. Hi Jeff,

    A simpler way to get the name of the current page is


    Is that what you meant?

    Microsoft MVP [ASP.NET]
    Ken Cox [Microsoft MVP], Jul 23, 2006
    1. Advertisements

  3. Jeff

    Jeff Guest


    Thanks for that tip, it helped me solve this problem!


    Jeff, Jul 24, 2006
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.