I have a radio list in my master page and they fire an event when I select one of them.
Now this event isn't not controlled by my master page instead it is controlled by my content page. My question is, is it possible to pass int/Strings from the master page method to content page method somehow.
P.S i want to pass the int i to content page method in this case
This is how i tide them up.
Master page Code to handle event
public event EventHandler Master_Save;
...
public void RadioButtonList1_SelectedIndexChanged(object sender, EventArgs e)
{
int i=RadioButtonList1.SelectedIndex;
if(Master_Save!=null)
{ Master_Save(this, EventArgs.Empty); }
}
and my content page code to handle the event
protected override void OnPreInit(EventArgs e)
{
base.OnPreInit(e);
(this.Page.Master as Pages_MasterPage).Master_Save += new EventHandler(ContentPage_Save);
}
private void ContentPage_Save(object sender, EventArgs e)
{
//Code that changes a query
}
Sure you can, just define a custom event args class and parametrize your event with it:
And then just use it: