Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Master pages and inline variables

Status
Not open for further replies.

B00gyeMan

Programmer
Jan 14, 2004
259
RO
I'm attempting to use master pages and I cannot link to a CSS who's path is dinamically generated and put in an inline variable.

In the master page's code file there is
Code:
public string sCSSPath = GetCommonCSSPath();

In the master page in the <head> section I have:
Code:
<link href="<%sCSSPath%>" type="text/css" rel="stylesheet"/>

Yet when I generate the page and check the source I see:
Code:
<link href="&lt;%sCSSPath%>" type="text/css" rel="stylesheet"

I hope that is not a bug in ASP.NET [mad][mad][mad][mad][mad]
 
I may be oversimplifying this, here goes -
Your code
<link href="<%sCSSPath%>" type="text/css" rel="stylesheet"/>

Try
<link href="<%=sCSSPath%>" type="text/css" rel="stylesheet"/>

You are missing the "=" short form notation for response.write.

hth

amit
 
I missed that when I wrote the post, in the code it is ok, but thanks for the reply anyway.
However, after performing intensive search I now know that this is a bug in ASP.NET 2.0 and it reproduces only when it comes to master pages. In the master page you cannot use inline variables in the manner previously described. It seems it only happens on the link tag (the script tag is ok)...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top