Call a method from MasterPage in Content Page

To access a method from master page in the content page ensure first:

  •       The method in master page is declared as public

than call this code from your content page code behind:

                     MasterPageClassName MyMasterPage = (MasterPageClassName)Page.Master;

         MyMasterPage.SetMenuToRegistered();

where:

  • SetMenuToRegistered() - is a method positioned in the master page class.

Print | posted @ Monday, December 01, 2008 2:58 AM

Comments on this entry:

Gravatar # re: Call a method from MasterPage in Content Page
by Jonas at 12/25/2008 9:36 PM

just a correction:

MasterPageClassName MyMasterPage = (MasterPageClassName)Page.Master;

MyMasterPage.SetMenuToRegistered();
Gravatar # re: Call a method from MasterPage in Content Page
by Diadiora Alexandru at 1/12/2009 10:51 PM

Thanks for your remark, I corrected the issue.
Gravatar # re: Call a method from MasterPage in Content Page
by jigar at 9/23/2009 1:43 AM

thx a lot
Post A Comment
Title:
Name:
Email:
Website:
Comment:
Verification: