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

Forum statistics

Threads
473,982
Messages
2,570,186
Members
46,740
Latest member
JudsonFrie

Latest Threads

Top