Solved

Reference the body tag in the Master Page?

Posted on 2008-10-27
1
505 Views
Last Modified: 2010-10-05
How do I refrerence the <body> tag in the Master Page programmatically?

I want to programmatically add "onwindowunload=somfunc()" to the body tag.
0
Comment
Question by:knowlton
1 Comment
 
LVL 16

Accepted Solution

by:
ororiole earned 500 total points
ID: 22814340
Give the body tag and runat attribute:
<body id="body1" runat="server" />

//if you are on the Master page you can access it directly:
 

body1.Attributes
 

//if you are on a content page you will need to find it first:

GenericHtmlControl body =  Master.Findcontrol("body1");
 

//I didnt compile this to check syntax but you get the idea

Open in new window

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

In this Article, I will provide a few tips in problem and solution manner. Opening an ASPX page in Visual studio 2003 is very slow. To make it fast, please do follow below steps:   Open the Solution/Project. Right click the ASPX file to b…
In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now