Click here to Skip to main content
15,886,063 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have master page. In that i need to fire preinit event.how can i write please help me.
I tried using this but ,it is not firing.
XML
<%@ Master Language="C#" CodeFile="Settings.master.cs" AutoEventWireup="true"
    Inherits="MasterPages_Settings" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
</head>
<body>
    <form id="form1" runat="server">
  <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <div>
 </div>
    </form>
</body>
</html>

and code behind code is.....
C#
public partial class MasterPages_Settings : System.Web.UI.MasterPage
{
 protected void Page_Init(object sender, EventArgs e)
    {
}
}



please any one help me.
Posted
Updated 28-Jan-15 18:32pm
v2

1 solution

XML
<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" Title="Page" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <p>Content</p>
    <p><asp:Label runat="server" ID="ContentPageLabel" /></p>
</asp:Content>

<script runat="server">
    protected override void OnPreInit(EventArgs e)
    {
        base.OnPreInit(e);
     
        ContentPageLabel.Text = "Hello!";
    }
</script>


try this code
 
Share this answer
 
Comments
Deepu S Nair 29-Jan-15 1:57am    
I think this will not work

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900