Calling usercontrol methods in master page from content page

  • Thread starter Thread starter Chevron Boyde
  • Start date Start date
C

Chevron Boyde

Hi All

I have a masterpage, MasterPage.master with a UserControl on it called
MemberEventsControl.ascx. It has a method on it callled GetMemberEvents().

I have a content page called Events.aspx that uses my master page. I need to
be able to call the MemberEventsControl.GetMemberEvents() method from an
event on the Events.aspx page.

Any help would be greatly appreciated.

C
 
It' totally doable.
You will need to use ClassName attribute on master page and UserControl
<%@ Master Language="C#" ClassName="myClass" %>

Then you could do in (C#)
((MyUserControl)((MyMasterPage)this.MasterPage).MyControl).GetMemeberEvents()

Also you might have to use following on your page.
<%@ Reference Page="path to .aspx page" Control="path to .ascx file"
virtualPath="path to file" %>

So the page becomes aware of the UserControl or MasterPage. It's mostly a
hint to compiler what to compile first.



George
 
Back
Top