masterpage.master
码
protected void btnAddLink_Click(object sender, EventArgs e)
{
//how can call btnSendMessage_Click
}
page1.aspx这个
<%@ Page Language="C#" MasterPageFile="~/masterpage.master" AutoEventWireup="true"
CodeFile="page1.aspx.cs" Inherits="page1"%>
代码
protected void btnSendMessage_Click(object sender, EventArgs e)
{
//how call btnAddLink_Click
}
如何在page1.aspx中调用btnAddLink_Click
如何在masterpage.master中调用btnSendMessage_Click
答案 0 :(得分:1)
在ASPX的顶部,在@Page标记下方,添加&lt;%@ MasterType ...标记。
<%@ Page Language="C#" MasterPageFile="~/masterpage.master" AutoEventWireup="true" CodeFile="page1.aspx.cs" Inherits="page1"%>
<%@ MasterType VirtualPath="~/masterpage.master" %>
然后,在后面的代码中:
protected void btnSendMessage_Click(object sender, EventArgs e)
{ Master.btnAddLink_Click(Nothing,Nothing); }