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

  • SEARCH
  • Home
  • 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 548921
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T11:07:51+00:00 2026-05-13T11:07:51+00:00

In a section in the <head> tags of my document I have code that

  • 0

In a section in the <head> tags of my document I have code that lets me use the Id of my asp.net control from JavaScript like this:

<script language="javascript" type="text/javascript">
var customerId = '<%= Me.CustomerTextbox.ClientID %>';
</script>

However, if I want to modify the page structure in later stages of the page life cycle, it give me an error because I have the ASP tags in there. A work-around is enclosing the ASP tags in a server control like this:

<div id="customerIdContainer" runat="server">
<script language="javascript" type="text/javascript">
var customerId = '<%= Me.CustomerTextbox.ClientID %>';
</script>
</div>

But then I get a warning that a div tag is not allowed in the head tag. So is there a container tag that is valid in the head that I can add runat=”server” to to make it a server control so I can workaround this problem without the warnings?

  • 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-05-13T11:07:51+00:00Added an answer on May 13, 2026 at 11:07 am

    Some thoughts:

    • Can you just make “head” into “runat=sever”?
    • If you use <asp:placeHolder id=”whatever” runat=”server” /> inside the head tag, will that complain? If not, you can add controls to the placeholder from the code.
    • Scripts can exist outside of the head tags, so just move it.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Site.Master in my ASP.NET project which defines a HEAD section as
I'm using ASP.NET MVC and I have a partial control that needs a particular
I have custom JSP tags that generate some HTML content, along with some javascript
In visual studio 2003 meta tags are listed in the head section itself. Where
OK, Here is my problem, I have a master page with a HEAD section
When I add this script to a plain HTML file's HEAD section <script type=text/javascript
Premise I'd like to use HTML Purifier to transform <body> tags to <div> tags,
typically the code is something like: <html> <head> <style type=text/css> body { font-size:12pt; font-family:
I am editing some code that I've inherited from elsewhere and there seems to
I'm having a problem with Javascript not executing when placed in the HEAD section

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.