jeudi 29 juin 2017

Pass a variable from child Page_Load to base Page_Load in ASP.net

I'm trying to do something similar to below. I have to web pages that inherit from a base class. I want to know which child page was loaded in the base Load_Page function.

public partial class MyClass : MyClassCore
{
    protected void Page_Load(object sender, EventArgs e)
    {
        string someVar = "whatever";
        Base.Page_Load();
    }
}

public partial class MyClass : MyClassCore
{
protected void Page_Load(object sender, EventArgs e)
    {
        if (someVar == "whatever")
            doStuff();
    }
}




Aucun commentaire:

Enregistrer un commentaire