LinkButton.Text Proprietà
Definizione
Importante
Alcune informazioni sono relative alla release non definitiva del prodotto, che potrebbe subire modifiche significative prima della release definitiva. Microsoft non riconosce alcuna garanzia, espressa o implicita, in merito alle informazioni qui fornite.
Ottiene o imposta la didascalia visualizzata sul controllo LinkButton.
public:
virtual property System::String ^ Text { System::String ^ get(); void set(System::String ^ value); };
[System.ComponentModel.Bindable(true)]
[System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.InnerDefaultProperty)]
public virtual string Text { get; set; }
[<System.ComponentModel.Bindable(true)>]
[<System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.InnerDefaultProperty)>]
member this.Text : string with get, set
Public Overridable Property Text As String
Valore della proprietà
La didascalia visualizzata sul controllo LinkButton. Il valore predefinito è una stringa vuota ("").
Implementazioni
- Attributi
Esempio
Nell'esempio seguente viene illustrato come utilizzare la Text proprietà per specificare la didascalia visualizzata nel LinkButton controllo .
<%@ Page Language="C#" AutoEventWireup="True" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>LinkButton Command Event Example</title>
<script language="C#" runat="server">
void LinkButton_Command(Object sender, CommandEventArgs e)
{
Label1.Text = "You chose: " + e.CommandName + " Item " + e.CommandArgument;
}
</script>
</head>
<body>
<form id="form1" runat="server">
<h3>LinkButton Command Event Example</h3>
<asp:LinkButton id="LinkButton1"
Text="Order Item 10001"
CommandName="Order"
CommandArgument="10001"
OnCommand="LinkButton_Command"
runat="server"/>
<br />
<asp:LinkButton id="LinkButton2"
Text="Order Item 10002"
CommandName="Order"
CommandArgument="10002"
OnCommand="LinkButton_Command"
Runat="server"/>
<br />
<br />
<asp:Label id="Label1" runat="server"/>
</form>
</body>
</html>
<%@ Page Language="VB" AutoEventWireup="True" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>LinkButton Command Event Example</title>
<script language="VB" runat="server">
Sub LinkButton_Command(sender As Object, e As CommandEventArgs)
Label1.Text = "You chose: " & e.CommandName & " Item " & _
e.CommandArgument
End Sub
</script>
</head>
<body>
<form id="form1" runat="server">
<h3>LinkButton Command Event Example</h3>
<asp:LinkButton id="LinkButton1"
Text="Order Item 10001"
CommandName="Order"
CommandArgument="10001"
OnCommand="LinkButton_Command"
runat="server"/>
<br />
<asp:LinkButton id="LinkButton2"
Text="Order Item 10002"
CommandName="Order"
CommandArgument="10002"
OnCommand="LinkButton_Command"
Runat="server"/>
<br />
<br />
<asp:Label id="Label1" runat="server"/>
</form>
</body>
</html>
Commenti
Utilizzare la Text proprietà per specificare o determinare la didascalia da visualizzare nel LinkButton controllo .
Attenzione
Questo controllo può essere usato per visualizzare l'input dell'utente, che potrebbe includere script client dannosi. Controllare le informazioni inviate da un client per lo script eseguibile, le istruzioni SQL o altro codice prima di visualizzarlo nell'applicazione. ASP.NET fornisce una funzionalità di convalida della richiesta di input per bloccare lo script e il codice HTML nell'input dell'utente. Vengono inoltre forniti controlli server di convalida per valutare l'input dell'utente. Per altre informazioni, vedere Sintassi del controllo server di convalida.
Il valore di questa proprietà, se impostato, può essere salvato automaticamente in un file di risorse usando uno strumento di progettazione. Per altre informazioni, vedere LocalizableAttribute Globalizzazione e localizzazione.
Si applica a
Vedi anche
Commenti e suggerimenti
https://aka.ms/ContentUserFeedback.
Presto disponibile: Nel corso del 2024 verranno gradualmente disattivati i problemi di GitHub come meccanismo di feedback per il contenuto e ciò verrà sostituito con un nuovo sistema di feedback. Per altre informazioni, vedereInvia e visualizza il feedback per