Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Ajax Custom Styles

Status
Not open for further replies.

deltaflyer666

Programmer
Jun 26, 2006
8
GB
I am trying to put together a site that will change style dependent upon the url data provided

The "Type" querystring value determines which data is returned from the database, i.e. type 1 = fish, type 2 = clothes, type 3 = spoons etc etc etc

I have the style sheet created that contains the styles wanted (example below)
[tt][highlight]
.color_fish{color:#FF0000;}
.color_clothes{color:#0000FF}
.color_spoons{color:#00FF00}
[/highlight][/tt]
based on the "Type" provided in the url i want to allocate different colors at runtime using the following code
[tt][highlight]
class='color_<% Response.Write(SiteColor(Request.Querystring("Type"))) %>'
[/highlight][/tt]
The sitecolor function simply does an if else statement to return the color needed for the "type" requested. i.e.
[tt][highlight]
if request.querystring("type") = "1" then
return "fish"
elseif request.querystring("type") = "2" then
return "clothes"
...
...
[/highlight][/tt]
Here is the question, The above response.write code embedded in the HTML works in normal asp.net 2.0 (i.e. type=1 font color=red, type=2 font color=blue etc) but how do i get this to work with Ajax inside an updatepanel?

Whenever the updatepanel is accessed i get an error saying response.write has altered the page. I don't want to create dozens of individual style sheets that can be applied server side at page load unless there is no alternative.

Any other (hopefully simpler) ideas?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top