473,405 Members | 2,310 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

C# - Cant dynamically set url of css file but can in vb.net??

Hi There,

Does anyone know iwhy I can do this in VB.Net:

<link rel="stylesheet" href="<%=Global_asax.GetApplicationPath()
%>styles/main.css" type="text/css">

in the header of an aspx page and not have a problem. i.e it converts nicely
but when i do it in c# it always converts the first "<" to ="&lt and thus
becomes

<link rel="stylesheet" href="&lt;% = MaranuiGlobal.GetApplicationPath()
%>styles/main.css" type="text/css" />

which in turn is not interpreted by the asp.net engine. Note this doesn;t
happen in the source file and is not a problem with the designer. It occurs
at runtime.
And yet as with vb.net this kind of statement in interpreted correctly for
all other tags including refs to javascript files. Its just with CSS/link
tags???

Thanks


Aug 24 '07 #1
2 2516
Please ignore difference in method name in the second statement:

<link rel="stylesheet" href="="&lt;%=Global_asax.GetApplicationPath()

I copy pasted the wrong code. This is not the problem.

Thanks
%>styles/main.css" type="text/css">
"Richard Coltrane" <rc@spamsux.comwrote in message
news:eM**************@TK2MSFTNGP05.phx.gbl...
Hi There,

Does anyone know iwhy I can do this in VB.Net:

<link rel="stylesheet" href="<%=Global_asax.GetApplicationPath()
%>styles/main.css" type="text/css">

in the header of an aspx page and not have a problem. i.e it converts
nicely but when i do it in c# it always converts the first "<" to ="&lt
and thus becomes

<link rel="stylesheet" href="&lt;% = MaranuiGlobal.GetApplicationPath()
%>styles/main.css" type="text/css" />

which in turn is not interpreted by the asp.net engine. Note this doesn;t
happen in the source file and is not a problem with the designer. It
occurs at runtime.
And yet as with vb.net this kind of statement in interpreted correctly for
all other tags including refs to javascript files. Its just with CSS/link
tags???

Thanks


Aug 24 '07 #2
>>
> <link rel="stylesheet" href="<%=Global_asax.GetApplicationPath()
%>styles/main.css" type="text/css">

Try using ResolveClientUrl instead ie.
<link rel="stylesheet" href="<%=ResolveClientUrl("~/styles/main.css")%>"
type="text/css">

Aug 24 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Jake Lewis | last post by:
I have an HTML page that loads fine including the .js file <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>Untitled Document</title> <script...
1
by: moid | last post by:
I am not able to add usercontrols to specific page in multipage (IE WebControls) i want to add usercontrol dynamically so that i can set its properties dynamically Regards Moid Iqbal
4
by: max | last post by:
Hello, Based on various posts, I've come up with the following code to load data into a js array dynamically without a screen refresh. It works, but you have to push the button twice before it...
11
by: skumar434 | last post by:
Hi everybody, I am faceing problem while assigning the memory dynamically to a array of structures . Suppose I have a structure typedef struct hom_id{ int32_t nod_de; int32_t hom_id;
1
by: vj | last post by:
How i can populate all fileds dynamically in jsp page based on contents found in xml file? I have written jsp servlets and java class file. i transferred automatic data from jsp to servlet then to...
1
by: dav3 | last post by:
Any help here is appreciated folks. First in my Person class the comments = errors visual basics is giving me and I am not sure why. Also when i try and set up my array of pointers to Student...
1
by: archana | last post by:
Hi all, Can anyone tell me how to generate xsd file dynamically for datatable. And then how to create datatable from that dynamically generated xsd file. I want to generate datatable from...
2
by: andrewanderson | last post by:
hi can anyone help me with this prog. cant find the prob why it cant display cout<<"This is the display of your transaction"<<endl; ifstream fobj; //declare input file stream ...
7
by: nikzworld | last post by:
Hi guyz, need help....!!! i have tabcontrol1 in mainform1 which dynamically adds a new tabpage based on the no of times a button is clicked on the main menubar. eg: if...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.