I have following environment:
- masterpage with a contentPlacholder
- multiple pages which use this masterpage and implement a base-class (
fooPage) fooPagehas a certain property (fooProperty)
Now i want to do something like
public partial class FooMaster : System.Web.UI.MasterPage
{
// this is originally from the designer-file
protected global::System.Web.UI.WebControls.ContentPlaceHolder ContentPlaceHolder;
protected override void OnPreRender(System.EventArgs e)
{
var fooPageInstance = this.ContentPlaceHolder as fooPage;
var fooPropertyInstance = fooPageInstance.fooProperty;
// TODO do something with the property
}
}
Obviously this is not going to work – but how can I achieve this?
I know the alternative: call a method from the masterPage in the contentPage with fooProperty as a parameter – but i would like to rather have a pull-system in this case…
1 Answer