I have a button on my MasterPage and I want the ContentPage to handle the Click event of the button. Here's what I have so far:
//Event in MasterPage
public event EventHandler Search_Submit;
//ButtonClick event in MasterPage
protected void SearchButton_Click(object sender, EventArgs e)
{
if (Search_Submit != null)
{
Search_Submit(this, EventArgs.Empty);
}
}
//EventHandler in Page_Init on ContentPage
Master.Search_Submit += new EventHandler(Master_Search_Submit);
//Search_Submit event in ContentPage
private void Master_Search_Submit(object sender, EventArgs e)
{
//Perform appropriate action...
}
This all works - however, I would like to pass a value with the EventArgs. I believe I need to create a custom EventArgs class that inherits from EventArgs and has my custom properties. However, my when I do that I get the following error: No overload for 'Master_Search_Submit' matches delegate 'System.EventHandler'.