Click here to Skip to main content
15,172,023 members
Please Sign up or sign in to vote.
1.44/5 (2 votes)
See more:
How to access the control of Master page in content Page
Thanks7872 15-Nov-13 6:59am

You need the @MasterPage Directive..

Like this:
<%@ MasterType virtualPath="~/MasterPage.master"%>

take a look at this: Working with ASP.NET Master Pages Programmatically[^]
Nicholas Marty 15-Nov-13 7:18am
yeah. of course this needs to be there too, but I'm assuming he's already doing that when he talks about "content Page" ;)
by adding MasterPageFile="~/Masterpage.Master" in your content page
Suppose you want to access the TextBox of Master page on the Content can be access like this

TextBox txtBox = this.Master.Master.FindControl("txtMasterPageMaster") as TextBox;

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