Solved

Reference the body tag in the Master Page?

Posted on 2008-10-27
1
507 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

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…
I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

773 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