CssStyleCollection.Remove Method (String)
.NET Framework (current version)
Removes a style item from the CssStyleCollection of a control using the specified style key.
Assembly: System.Web (in System.Web.dll)
Parameters
- 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="VB" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <script runat="server"> Protected Sub SubmitBtn_Click(ByVal sender As Object, ByVal e As System.EventArgs) FirstSelect.Style.Remove("font") End Sub </script> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>CssStyleCollection Remove Example</title> </head> <body> <form id="form1" runat="server"> <div> Click the submit button to clear the font formatting. <br /> <select id="FirstSelect" style="font: 14pt Arial; background-color:Yellow; color:Blue;" runat="server"> <option >option 1</option> <option >option 2</option> <option >option 3</option> </select> <input id="SubmitBtn" value="Submit" type="submit" onserverclick="SubmitBtn_Click" runat="server" /><br /> </div> </form> </body></html>
.NET Framework
Available since 1.1
Available since 1.1
Show: