Solved

Reference the body tag in the Master Page?

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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

707 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

15 Experts available now in Live!

Get 1:1 Help Now