Communication problem on the main page and content page

I have a homepage on my website and I have control over the homepage. I want to handle the master page control event on the content page.

How can i do this??

even i used a property like this for a drop down control

public  DropDownList propertymastercontrol
{
    get
    {
        return cmbVendor;   //drop down id
    }
}

and set the homepage link on a content page like this ...

<%@ MasterType VirtualPath ="~/MasterPage.master" %>

still after having failed to get any page_load event.

protected void Page_Load(object sender, EventArgs e)
    {
        Master.
    }

what could be the problem ..?

+3
source share
4 answers

I'm not sure about C #, but in VB.NET I did this with these four steps:

  • Add events to MasterPage code behind, raise these events as needed
  • aspx: <%@ MasterType VirtualPath="~/master.Master" %>
  • , codebehind ( # VB.NET)
  • codebehind

UPDATE:

, MasterPage ( ). , , Pass MasterPage ImageButton , SO .

+2

, page_Load . , .

on preInit:

this.MasterPageFile = "~/masterPage.master"; //change this to where your master page resides.
0

, , :

, , .ASPX UserControls. , MasterPage UserControl .

MasterPage ImageButton

0

- . Page_Load :

protected void Page_Load(object sender, EventArgs e)    
{
    DropDownList cmbVendor = (DropDownList)Master.FindControl("cmbVendor");
    cmbVendor.TextChanged += new EventHandler(cmbVendor_TextChanged);
}

, MasterPage DropDown . Pass MasterPage ImageButton , .

0

Source: https://habr.com/ru/post/1721387/


All Articles