Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Access Master Page public method from user control/class/page

I am to access a method on my master page. I have an error label which I want to update based on error messages I get from my site.

public string ErrorText
{
    get { return this.infoLabel.Text; }
    set { this.infoLabel.Text = value; }
}

How can I access this from my user control or classes that I set up?

like image 539
Churchill Avatar asked Oct 25 '10 09:10

Churchill


1 Answers

To access the masterpage:

this.Page.Master

then you might need to cast to the actual type of the master page so that you could get the ErrorText property or make your master page implement an interface containing this property.

like image 92
Darin Dimitrov Avatar answered Oct 19 '22 19:10

Darin Dimitrov