This documentation is archived and is not being maintained.

CssStyleCollection.Remove Method (String)

Removes a style item from the CssStyleCollection of a control using the specified style key.

Namespace:  System.Web.UI
Assembly:  System.Web (in System.Web.dll)

public void Remove(
	string key


Type: System.String
The string literal of the style item to remove.

The following example demonstrates how to use the Remove method to programmatically delete a CSS style from an HtmlSelect control.

<%@ Page Language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">

<script runat="server">

  protected void SubmitBtn_Click(object sender, EventArgs e)

<html xmlns="" >
<head runat="server">
    <title>CssStyleCollection Remove Example</title>
    <form id="form1" runat="server">
    Click the submit button to clear the font formatting.
    <br />
    <select id="FirstSelect" 
            style="font: 14pt Arial; background-color:Yellow; color:Blue;"
        <option >option 1</option>
        <option >option 2</option>
        <option >option 3</option>
    <input id="SubmitBtn" 
           runat="server" /><br />

.NET Framework

Supported in: 4, 3.5, 3.0, 2.0, 1.1, 1.0

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.