calling a method on the parent page from a user control

Posted by Kyle on Stack Overflow See other posts from Stack Overflow or by Kyle
Published on 2010-05-03T16:01:03Z Indexed on 2010/05/03 16:08 UTC
Read the original article Hit count: 265

Filed under:
|
|
|

I am using a user control that I created (just a .cs file not an .ascx file), that does some magic and depending on a value generated by the control, I need it to do something on the parent page that is 'hosting' the control. It needs to call a method under certain circumstances (method is on the parent control).

the control is placed on the parent page like so:

<customtag:MyControl ID="something" runat="server" />

I'm dynamically creating buttons etc on the control itself but when a button is clicked, let's say for example that there's a text box on the control and if the value of the textbox is "bob" it needs to call a method on the page that's housing the control...how can I accomplish this?

© Stack Overflow or respective owner

Related posts about usercontrols

Related posts about ASP.NET