There is also the @Master directive ( MSDN Article ). This method provides a way to create a strongly typed link to the ASP.NET master page when accessing the master page from the Master property.
The result is the same as indicated, strongly typed, and there is no need to drop.
Usage example:
<%@ MasterType VirtualPath="~/masters/SourcePage.master"" %>
Using this directive actually gives the same code as the @Scott implementation, but does not require you to know the type of the main page.
Then you can start using your main page by saying:
Master.Title = "My Page Title";
You can also trigger events from the master in this way. Use Master.FindControl to find the desired management wizard.
Search example:
HtmlAnchor btnMyImageButton = (HtmlAnchor)Master.FindControl("btnMyImageButton");
BUT, I would suggest using the OnClick property for ImageButton and setting it to the public void / Sub on the main page. Then just call it void / Sub like:
Master.ImageButtonClick();
source share