Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7937421
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T22:31:22+00:00 2026-06-03T22:31:22+00:00

I am working on a web application that uses a frameset instead of a

  • 0

I am working on a web application that uses a frameset instead of a master page. I want to set up the app so that the background color of all pages is a light shade of red whenever I am debugging locally with a production connection string.

I came across one question here on StackOverflow where someone suggested creating a base page from which all page inherit, but I need a dynamic approach that just works without having to edit every page class in the application. Switching over to use master pages at this point is not an option.

Is there a way to use global.asax or some other means to inject a style or script tag into the head of every document that loads?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T22:31:24+00:00Added an answer on June 3, 2026 at 10:31 pm

    Wooter wooter!

    Private Sub Global_asax_PreRequestHandlerExecute(sender As Object, e As System.EventArgs) Handles Me.PreRequestHandlerExecute
    
        Dim p As Page = TryCast(System.Web.HttpContext.Current.Handler, Page)
    
        If Not p Is Nothing Then p.ClientScript.RegisterStartupScript(p.GetType, Guid.NewGuid.ToString("n"), "document.body.style.backgroundColor = 'red';", True)
    
    End Sub
    

    The key is to grab the page reference and then assign a startup script to it to add a style to the body element. Basically, once you know how to get a reference to the page object, the sky’s the limit. Of course, a master page is always recommended for ground-up development, but this should get you some quick and dirty functionality if you ever need it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a working web application that uses username/password SpringSecurity configuration. Now I want
All, I'm working on a web application for iOS that uses a fixed position
I am working on an web application that uses themes and different master pages.
I am currently working on an web application that uses ASP.NET 2.0 framework. I
I am currently working on a web application that uses PHP and MySQL, but
I'm working on a web application that will return a variable set of modules
I'm working on a web application that submits tasks to a master/worker system that
I'm working on a web application that uses ASP.NET 3.5 and C#. Structurally, I
I'm working on a Ruby web Application that uses the Net::FTP library. One part
I have a web application set up on our intranet that uses windows authentication

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.