Reputation: 205
On loading of every content page, I want to get content page name. So I want to know that which Master Page event is fired on every content page load ?
Upvotes: 1
Views: 3077
Reputation: 29186
Here's a resource that might help, it states the events that ocur for ASP.NET pages:
http://weblogs.asp.net/ricardoperes/archive/2009/03/08/asp-net-page-events-lifecycle.aspx
Also here is the official documentation about ASP.NET page lifecycle which goes into detail about all the events. Hopefully this will help you.
EDIT;
Hmmm, actually the above looks a bit over the top. It looks like all you need to do is - in each content page, make sure you reference the master page in the ASPX file:
<%@ MasterType virtualpath="~/Masters/Master1.master" %>
Then in the master page have a public method such as:
public void LogContentPageName(string name)
{
// Do whatever you want with the passed name.
}
Then in the Page_Load event of the content pages you can do:
protected void Page_Load(object sender, Eventargs e)
{
Master.LogContentPageName("Whatever");
}
Upvotes: 2
Reputation: 2045
Please try with below event
protected override void OnInit(EventArgs e) { //do your stuff here }
Upvotes: 0