I have a master page and a content page. Not quite sure how to do this. How do I reset/refresh the content page after I do something in the Master page. The something I'm doing is changing a dropdown list and which then dictates what you can see in the content page. If I could call the page load of the content page from the master page that would do it.
Thank you
Handle a custom event of the masterpage in the page.
//Event in MasterPage
public delegate void SomethingSelected(object sender, String SelectedValue);
public event SomethingSelected OnSomethingSelected;
//SelectedIndexChanged event in MasterPage
protected void DropDonwnList1_SelectedIndexChanged(object sender, EventArgs e)
{
OnSomethingSelected(sender, ((DropDownList)sender).SelectedValue);
}
The content page(assuming the type of it is called SiteMaster):
protected void Page_Init(object sender,EventArgs e){
var master = (SiteMaster)Page.Master;
master.OnSomethingSelected += MasterSelected;
}
private void MasterSelected(object sender, string selectedValue)
{
// now you can handle the master's event and update your content page
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With