I am trying to call a function on the masterpage from a content page in the codebehind.
Here is my attempt:
ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alert__", string.Format("setStatusBarMessage('{0}',{1});", barMessage, type, ""), true);
The "setStatusBarMessage" function is declared in the masterpage, so this code isn't working.
setStatusBarMessage is a client-side function.
MasterPage:
<%@ 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>
ContentPage :
<%@ 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>
This masterpage and content page are contained within an iframe object.