how to call host page function from user control

  • Thread starter Thread starter Jerry Qu
  • Start date Start date
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
 
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)
 
Back
Top