我在母版页上有一个函数,我想从代码隐藏的内容页面调用它。
这是我的尝试:
ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alert__", string.Format("setStatusBarMessage('{0}',{1});", barMessage, type, ""), true);
“setStatusBarMessage”函数在 masterpage 中声明,所以这段代码不起作用。
setStatusBarMessage 是一个客户端函数。
母版页:
<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Content.master.cs"
Inherits="F8.CRM.Pages.Content" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<asp:ContentPlaceHolder ID="head" runat="server">
</asp:ContentPlaceHolder>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager runat="server" />
<div>
<asp:ContentPlaceHolder ID="MainContent" runat="server">
</asp:ContentPlaceHolder>
</div>
</form>
</body>
</html>
<script type="text/javascript">
function hello() {
alert('hi mennan');
}
</script>
内容页 :
<%@ Page Title="" Language="C#" MasterPageFile="~/Pages/Content.Master" AutoEventWireup="true"
CodeBehind="Departman.aspx.cs" Inherits="F8.CRM.Departman" %>
<%@ Register Src="~/Controls/Objects/StudioSideBox/StudioSideBox.ascx" TagName="StudioSideBox"
TagPrefix="uc1" %>
<%@ Register Src="~/Controls/Objects/Baslik/Baslik.ascx" TagName="Baslik" TagPrefix="uc2" %>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
my html...
<script type="text/javascript">
my script codes...
</script>
</asp:Content>
此母版页和内容页位于 iframe 对象下。