1

I have <% %> blocks already on my master page head tag and i want to register a css from code behind.

I have already tried the approach mentioned here

but that won't work.

I tried something like this

 <link type="text/css" href="<%= this.BaseUrl %>/styles/styles.css" />

Which did not work too.. it works for script references but not for css.

Any idea how can this be achieved?

1 Answer 1

2

Guys got it working...!

Never thought it would be this simple.. :D

Here is the code:

Master page Head tag has :

<link type="text/css" href="#" runat="server" id="cssID" />

master page code behind has following in page load:

cssID.Href = string.Format("{0}/styles/styles.css", this.StyleUrl);
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.