Click here to Skip to main content
15,893,381 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi i am using VS 2008.
My problem is big but this is how i can summarise it to get a hint as to what to do ?

I hav 1 master page in my project and seveeral associated content pages. I want to give a condition(IN MY MASTER PAGE) like this...


if(intended page== A.aspx || intended page== B.aspx || intended page== C.aspx)
{

Label.Text="You are in Survey"
}
else
if(intended page== D.aspx || intended page== E.aspx || intended page== F.aspx)
{

Label.Text="You are in Feedback"
}

My Query : How can i get the access of current intended page...i tried this ...
Request.Url.LocalPath.ToString() == "/feedback360/Default.aspx"
Is there any other option other than this ?

Please help as i am stuck from few hours ...
Posted

1 solution

MasterPage is just like a Control of a page, You may get the current running page with this code.

C#
public partial class Test_MasterPage : System.Web.UI.MasterPage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        string s = (this.NamingContainer as Page).Request.Url.ToString();
    }
}


hope it helps.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900