Insert <link rel="stylesheet"....>

I

Islam Elkhayat

Hello everybody

Ihave few .CSS files, I let user select the color schema of the whole site
using a radiobutton and save it in a cookie..
I want to retrieve the value of the cookie <link href=" HERE "
rel="stylesheet">
i try to put it using InnerHtml or InnerText but it fail using div, span so
on...
how can i handle this..
thanx
 
G

Guest

Just use good old variables. In code behing add a public variable and then
insert server side script inside href like this:
<link href=" <%=strCSSName%>" rel="stylesheet">
 
K

Karl Seguin

I think it's safe to say that that's a bad suggestion. This isn't ASP.

Instead, try doing:
<link rel="stylesheet" type="text/css" id="link" runat="server" />

and in codebehind:

protected HtmlGenericControl link;
private void Page_Load(object sender, EventArgs e) {
link.Attributes.Add("href", "somestyle.css");
}

Karl
 

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

Members online

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,817
Latest member
DicWeils

Latest Threads

Top