In my child user control I have a gridview with an OnRowCommand eventhandler that is executed when Edit button is click. I want to set the visibility of an ASP.NET placeholder control in the parent to true when the Edit button is clicked in child control.
What would be the best way to accomplish this task?
Update:
After a little bit more research on the internets, I create a public event Eventhandler in my child control and rasied the event when the OnRowCommand event was fired. In my page_load event of my parent control, i mapped the child user control event to an private event in my parent control.
Child Control source code:
public event EventHandler MyEvent;
protected void MyGridView_OnRowCommand(object sender, GridViewCommandEventsArgs e)
{
if(MyEvent != null)
MyEvent(sender, e);
}
Parent Control source code:
protected void Page_Load(object sender, EventArgs e)
{
MyChildControl.MyEvent += new EventHandler(this.MyLocalEvent);
}
private void MyLocalEvent(object sender, EventArgs e)
{
MyPlaceHolder.Visible = true;
MyUpdatePanel.Update();
}