I\'ve a user control registered in an aspx page
On click event of a button in the user control, how do i call a method which is there in the parent page\'s code
You can use Session . Say when you click on a button in user control and when you want to call Parent page method then in event handler of button click set value as
Session["CallParent"]="someValue";
as button will post back the page . On Page_Load event of Parent Page add it
protected void Page_Load(object sender,EventArgs e)
{
if(Session["CallParent"]!=null)
{
// here call the Parent Page method
Method1();
// now make the session value null
Session["CallParent"]=null;
}
}
It is much more efficient