change user interface dynamically using css files

A

Amir Eshterayeh

Dear Friends
I need to change the css file of my aspx files dynamically so users can
choose their css file names and when page loads, it read css file name from
database.
I try to use response.write to write this way:
Dim i As Integer = 1
If i = 1 Then
Response.Write("<LINK href=""Stylesone.css"" type=""text/css""
rel=""stylesheet"">")
Response.Write("<script language =""javascript"" src = ""testone.js"">
</script>")
Else
Response.Write("<LINK href=""Stylestwo.css"" type=""text/css""
rel=""stylesheet"">")
Response.Write("<script language =""javascript"" src = ""testtwo.js"">
</script>")
End If


but you know, the ealiest time I can use this is page load event that
writes that string at the top of generated html file that works but is there
a way I can write this string in the head tage not at first line of
generated html.
Also, it there a better way to change the user interface dynamically (based
on users preferences and types) like XML, XSL, XSLT,...
Thanks in advance

Amir Eshterayeh
(e-mail address removed)
 
J

Jos

Amir said:
Dear Friends
I need to change the css file of my aspx files dynamically so
users can choose their css file names and when page loads, it read
css file name from database.
I try to use response.write to write this way:
Dim i As Integer = 1
If i = 1 Then
Response.Write("<LINK href=""Stylesone.css"" type=""text/css""
rel=""stylesheet"">")
Response.Write("<script language =""javascript"" src =
""testone.js""> </script>")
Else
Response.Write("<LINK href=""Stylestwo.css"" type=""text/css""
rel=""stylesheet"">")
Response.Write("<script language =""javascript"" src =
""testtwo.js""> </script>")
End If


but you know, the ealiest time I can use this is page load event that
writes that string at the top of generated html file that works but
is there a way I can write this string in the head tage not at first
line of generated html.
Also, it there a better way to change the user interface dynamically
(based on users preferences and types) like XML, XSL, XSLT,...
Thanks in advance

Amir Eshterayeh
(e-mail address removed)

You can change the <head> tag into an HTML control like this:
<head id="myhead" runat="server">
...permanent content here...
</head>

Then, you can modify it from code like this:
Sub Page_Load(sender As Object, e As EventArgs)
myhead.InnerHtml &="<LINK href=""Stylesone.css"" type=""text/css""
rel=""stylesheet"">"
End Sub
 

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