V
V
vais2014-10-02 23:52:29
ASP.NET
vais, 2014-10-02 23:52:29

How to get access to methods\controls in master page?

Hey!
A website consists of a master page and content pages.
The masterpage code file is as follows:

public partial class MasterPage : System.Web.UI.MasterPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            //PopupAdd();
        }

        public void PopupAdd()
        {
            popupOverlay.Attributes.CssStyle.Add(HtmlTextWriterStyle.Display, "inline-block");
        }
    }

popupOverlay is a div block (if that matters).
There is a regular class, let's call it ButtonInsert , located in the app_code
folder Question:
How can I access either the PopupAdd () method or the popupOverlay div directly from ButtonInserta ?
MasterPage test =new MasterPage();
does not roll =( masterpage methods, does not see a freshly created instance of the class.
Thank you.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
DVamp1r3, 2014-10-03
@vais

Build your own logic so that MasterPage asks something what to "draw" and in what cases. In general, MasterPage is needed as a template, there is not enough complex logic there.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question