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 6546963
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T11:46:21+00:00 2026-05-25T11:46:21+00:00

I have a situation where I need to dynamically load a URL prefix. I

  • 0

I have a situation where I need to dynamically load a URL prefix.

I wrote a quick control to handle this and it works for the following instance:

<script type="text/javascript" src='<gbn:AdminPath runat="server" id="Id1" />Rest/Of/Path.js'></script>

But the following case (on the same aspx page) does not work:

<link rel="stylesheet" href='<gbn:AdminPath runat="server" id="Id2" />/css/styles.css'>

This shows up in the browser as:

<link rel="stylesheet" href="&lt;gbn:AdminPath runat=&quot;server&quot; id=&quot;Id2&quot; />/css/styles.css" />

I’ve tried various things, but I can’t seem to get the tags working. Any suggestions?

Thanks

  • 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-25T11:46:21+00:00Added an answer on May 25, 2026 at 11:46 am

    The problem here is that it treats <link> elements in the <head> section like they are server controls. It does this, I believe, so that you can use app-relative urls (eg “~/myfolder/file.css”) and have them resolved for you. It does not give this same treatment to <script> tags, though.

    Since they are treated as server controls, you cannot mix inline script and string literals in a property value or it all gets treated as a literal (as you discovered).

    To get around this, you have several options, one of which TheGeekYouNeed outline above.

    If you still want to do it inline with a public method, you can, but you have to build the whole property value in your code like the following:

    <link rel="stylesheet" href='<%= string.Format("{0}/css/styles.css", GetAdminPath() %>' type="text/css" />
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Ok, so I have the following situation. I need to edit the PYTHONPATH dynamically
In a Flex Mobile Application, I have a situation where I need to dynamically
There is a need to provide some sort of interface(save/edit/load) to dynamically generated styles
I have a situation where I need to know what methods are being called
I have to set background images (sprite pngs) within 3 divs. I need the
Situation I have 5 Access DB files, each one has 10 tables, 40 queries
I am trying to dynamically map JSON information into different objects. But I can't
Situation: I am making a Collapsible Panel. In my business situation, I am required
I have a bit of a mess of a file system here at work,

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.