Thursday, May 22, 2008

ASP.NET Master Pages and overriding attributes of Body tag

Default.Master page

<body id="MasterPageBody" runat="server" >
</body>

Code behind

public HtmlGenericControl Body
{
     getreturn this.MasterPageBody}
     setthis.MasterPageBody = value;}
}

Content pageRegister

<%@ MasterPage VirtualPath="~/virtual/path/to/your/master/page" %>

Code Behind

public void Page_Load(object sender, EventArgs e)
{
     this.MasterPageBody.Attributes
            .Add("onload","javascript:alert('I am here')");
}
 

No comments:

Azure Storage Account Types

Defferent Types of Blobs Block blobs store text and binary data. Block blobs are made up of blocks of data that can be managed individually...