Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Accessing a control on Content Page from Site.Master

Status
Not open for further replies.

sds814

Programmer
Feb 18, 2008
164
US
Below is the structure of my web application.

- Site.Master

- MappingTable.Master

- DataPage.aspx (Content Page)

From Site.Master, I need to disable a button on the DataPage.aspx. How would I do that?

Thanks!
 
From Site.Master, I need to disable a button on the DataPage.aspx. How would I do that?
You don't, or actually you shouldn't. You can do it with code like this:

However, read further on in the post, and you will see reasons why you shouldn't , reusability being one of them.

The master page is a shell, and should not be "tied" to any particular content page. If you look at the example in the link above, that is exactly what will happen.
What happens if you click the button on the master page and there is no textbox on the content page? An error. Then you have to write bad code to check if the textbox is there etc.
The content pages should be "disconnected from the master page". The content pages can access things on the master page, but the master should not directly access the content.

Why don't you explain further what exactly you are trying to do and why, and maybe we can come up with a better solution for you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top