J
Jason_SanDiego2006
Hello all,
Hang with me, I'm a little new.
I'm working on a web application in C# using ASP.NET 2.0
The goal of my application is to have pages whose styles can be dynamically
changed based on the logged-in user's saved preferences.
The user can define their own styles (font-size, font-family, color, etc.)
for the site's pages.
Instead of creating a bunch of .css files and dynamically linking to the
right one, I wanted to use a <style> section in each page's <head> section
that specifies the values to use for the selectors and their properties.
The values would be pulled from a database and written to this section, to
look like this:
<head>
<style type="text/css">
.testClass { colorurple;background-color:LightGreen; }
</style>
</head>
I have been able to do this, using this syntax:
Style myStyle = new Style();
myStyle.ForeColor = System.Drawing.Color.Purple;
myStyle.BackColor = System.Drawing.Color.LightGreen;
Page.Header.StyleSheet.CreateStyleRule(myStyle, this, ".testClass");
But not every available property will have a value defined for it in my
database. Is there a way to set the property and value by name and value,
like
myStyle.SetProperty("Color","Red")
Or a better way to achieve this...?
Thanks in advance,
Jason
Hang with me, I'm a little new.
I'm working on a web application in C# using ASP.NET 2.0
The goal of my application is to have pages whose styles can be dynamically
changed based on the logged-in user's saved preferences.
The user can define their own styles (font-size, font-family, color, etc.)
for the site's pages.
Instead of creating a bunch of .css files and dynamically linking to the
right one, I wanted to use a <style> section in each page's <head> section
that specifies the values to use for the selectors and their properties.
The values would be pulled from a database and written to this section, to
look like this:
<head>
<style type="text/css">
.testClass { colorurple;background-color:LightGreen; }
</style>
</head>
I have been able to do this, using this syntax:
Style myStyle = new Style();
myStyle.ForeColor = System.Drawing.Color.Purple;
myStyle.BackColor = System.Drawing.Color.LightGreen;
Page.Header.StyleSheet.CreateStyleRule(myStyle, this, ".testClass");
But not every available property will have a value defined for it in my
database. Is there a way to set the property and value by name and value,
like
myStyle.SetProperty("Color","Red")
Or a better way to achieve this...?
Thanks in advance,
Jason