Im trying to disable a button on the masterpage from a content page when certain criteria are met. I can change the text on masterpage buttons using session variables, but IM having a bit of trouble with this latest bit - any hints anyone?
The master page establishes a layout and includes one or more ContentPlaceHolder controls for replaceable text and controls. The content page includes only the text and controls that are merged at run time with the master page's ContentPlaceHolder controls.
The Page class in the System. Web. UI namespace includes a MasterPageFile property that returns the path to the content page's master page; it is this property that is set by the @Page directive. This property can also be used to programmatically specify the content page's master page.
On your Master Page you would have a public function like so:
public void EnableTheButton(Boolean enable) {
btnTheButton.Enabled = enable;
}
On your content page you would write:
((MyMasterType)this.Master).EnableTheButton(false);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With