|
Il presente articolo è stato tradotto automaticamente. Passare il puntatore sulle frasi nell'articolo per visualizzare il testo originale. Ulteriori informazioni.
|
Traduzione
Originale
|
Proprietà WebControl.CssClass
Spazio dei nomi: System.Web.UI.WebControls
Assembly: System.Web (in System.Web.dll)
Nota sulla sicurezza |
|---|
<asp:TextBox id="TextBox1" ForeColor="Red" CssClass="class1" />
<input type=text class="class1" style="ForeColor:red">
Nota |
|---|
| Topic | Location |
|---|---|
| Procedura: creare fogli di stile CSS esterni (Visual Studio) | Generazione di applicazioni Web ASP.NET in Visual Studio |
Nota |
|---|
<%@ Page Language="C#" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <script runat="server"> void Button1_Click(object sender, EventArgs e) { if (HyperLink1.CssClass == "CssStyle1") HyperLink1.CssClass = "CssStyle2"; else HyperLink1.CssClass = "CssStyle1"; } </script> <html xmlns="http://www.w3.org/1999/xhtml" > <head id="Head2" runat="server"> <title>CssClass Property Example</title> <style type="text/css"> .CssStyle1 { font: 10pt Verdana; font-weight:700; color: Green; } .CssStyle2 { font: 15pt Times; font-weight:250; color: Blue; } </style> </head> <body> <form id="form1" runat="server"> <div> <h3>CssClass Property of a Web Control</h3> <asp:HyperLink id="HyperLink1" NavigateUrl="http://www.microsoft.com" CssClass="CssClass1" Text="Click here to go to the Microsoft site" Target="_new" runat="server" /> <p><asp:Button id="Button1" Text="Click to change the CSS style of the link" OnClick="Button1_Click" runat="server" /> </p> </div> </form> </body> </html>
<html>
<head>
<style>
.CssStyle1
{
font: 12pt verdana;
font-weight:700;
color:orange;
}
.CssStyle2
{
font: 15pt times;
font-weight:250;
color:blue;
}
</style>
<script language="C#" runat="server">
void Button1_Click(Object sender, EventArgs e) {
HyperLink1.CssClass=((HyperLink1.CssClass=="CssStyle1")?"CssStyle2":"CssStyle1");
}
</script>
</head>
<body>
<h3><font face="Verdana">CssClass Property of a Web Control</font></h3>
<form runat="server">
<asp:HyperLink id="HyperLink1" NavigateUrl="http://www.microsoft.com"
CssClass="spanstyle" Text="Click here to go to the Microsoft site"
Target="_new" runat="server"/>
<p>
<asp:Button id="Button1" Text="Click to change the Css style of the above link"
OnClick="Button1_Click" runat="server"/>
</form>
</body>
</html>
Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (ruoli di base del server non supportati), Windows Server 2008 R2 (ruoli di base del server supportati con SP1 o versione successiva, Itanium non supportato)
.NET Framework non supporta tutte le versioni di ciascuna piattaforma. Per un elenco delle versioni supportate, vedere Requisiti di sistema di .NET Framework.
Nota sulla sicurezza