Saturday, August 22, 2009

Changing Css Class or Style At Run time dynamically in Asp

·

You can add/change css style or add new attributes to current style at runtime, in asp.net code behind.

Lets say you have:

Download

Now if we want to change its class dynamically then in code behind we have to do:

linktemp.Attributes.Add(”class”, “verdana13greynormalitalic”);

if we want to change its text-decoration under style then,

linktemp.Style.Add(”text-decoration”, “none”);

in the similar you can add new styles, change visible option to true/false,

linktemp.Style.Add(”display”, “block”);

0 comments: