Home > DeveloperSection > Forums > Removing class from a div in c#
Manoj Bhatt
Manoj Bhatt

Total Post:153

Points:1079
Posted on    February-04-2014 5:50 AM

 C# C# 
Ratings:


 1 Reply(s)
 2919  View(s)
Rate this:

I tried using the server-side .CssClass, but this isn't available for me to use. My div has runat="server" so I can access it, but I just cannot see .CssClass in the drop-down when i hit ".". Does anyone know how to get past this or any other solution that might work?




Pravesh Singh

Total Post:411

Points:2881
Posted on    February-04-2014 6:01 AM

Hi Manoj,

If you are wanting to read the class name, you will need to use the code:

string className = Test.Attributes["class"].ToString();

If you are wanting to replace a specific class you will need to use the code:

Test.Attributes.Add("class", Test.Attributes["class"].ToString().Replace("spacerDiv", ""));


Don't want to miss updates? Please click the below button!

Follow MindStick