how to call host page function from user control

J

Jerry Qu

Hi All,

I thought this should work but I got compile error:

1) in the host page expose function to public
2) in the ascx <% Reference Page = "~/home.aspx"/>
3) in the ascx.cs:

if (Page is home)
((home)Page).myCall(sender, e);


4) after I add <% Register %> to include the ascx to home.aspx I got
circuled reference file error.

Then how to call a function of host page from a user control?

TIA

JQ
 
B

bruce barker

the proper way to do this is to define an interface (in appcode) and
have the page implement the interface.

then:

var caller = Page as IMyCaller;
if (caller != null)
caller.myCall(sender,e);

-- bruce (sqlwork.com)
 

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

Top