Calling usercontrol methods in master page from content page

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
 
G

George

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top