---
title: "Removing class from a div in c#"  
description: "Removing class from a div in c#"  
author: "Manoj Bhatt"  
published: 2014-02-04  
updated: 2014-02-04  
canonical: https://www.mindstick.com/forum/1957/removing-class-from-a-div-in-c-sharp  
category: "c#"  
tags: ["c#"]  
reading_time: 1 minute  

---

# Removing class from a div in c#

I tried using the [server](https://www.mindstick.com/articles/43769/what-is-serverless-architecture-is-it-worth-switching-over)-side .CssClass, but this isn't available for me to use. My div has runat="server" so I can [access](https://www.mindstick.com/articles/12994/how-foreigners-can-access-blocked-websites-in-china) it, but I just cannot see .CssClass in the [drop](https://www.mindstick.com/forum/159392/how-to-fetch-the-value-of-the-selected-options-in-drop-down-in-php)-down when i hit ".". Does [anyone](https://www.mindstick.com/articles/23207/how-to-find-the-best-fit-job-for-anyone) know how to get [past](https://www.mindstick.com/articles/13129/great-tools-for-continuing-your-education-past-college) this or any other solution that might work?

\

## Replies

### Reply by Pravesh Singh

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", ""));


---

Original Source: https://www.mindstick.com/forum/1957/removing-class-from-a-div-in-c-sharp

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
