asp.net tags

A

Amir Ghezelbash

Hey guys
doesn any one know why this happnes

i have a master page with a public property

public string CssFileName {
get {
return css;
}
set {
css = value;
}
}

now in my master page i have a tag like this
<link href="Scripts/Css/<%= CssFileName %>" rel="stylesheet"
type="text/css" />


but this renders as

<link href="Scripts/Css/&lt;%= CssFileName %>" rel="stylesheet"
type="text/css" />


but the same method works for Javascript tag it renders it fine

any idea why this happnes?
 
S

Scott Allen

Hi Amir:

Are you trying to set the style sheet dynamically?

Have you tried just placing the .css file inside of a directory of
App_Themes? The ASP.NET runtime will automatically inject css files
for the currently selected theme.
 
A

Amir Ghezelbash

Hello

Yes i am

i have a JS file and a CSS file for every page on my website...all these
pages inherit from the master page
so i would like to assing each pages JS and CSS file dinamically

so my Register.aspx page will have Register.JS and Register.Css file

and in load page i would do something like
((MasterPage)this.Master).CssFileName = "Main.css";
((MasterPage)this.Master).JSFileName = "Main.js";

but like i said.... that link tag isnot rendering right

any ideas?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top