Condividi tramite


HtmlAnchor.HRef Proprietà

Definizione

Ottiene o imposta la destinazione URL del collegamento specificato nel HtmlAnchor controllo server.

public:
 property System::String ^ HRef { System::String ^ get(); void set(System::String ^ value); };
public string HRef { get; set; }
member this.HRef : string with get, set
Public Property HRef As String

Valore della proprietà

Destinazione URL del collegamento.

Esempio

Nell'esempio di codice seguente viene illustrato come utilizzare la HRef proprietà per specificare una pagina Web a cui passare quando si fa clic sul HtmlAnchor 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 runat="server">
    <title>ASP.NET Example</title>
</head>
<body>
      <form id="form1" method="post" runat="server">
  
         <a href="http://www.microsoft.com" runat="server"> Enter site.</a>
  
      </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 runat="server">
    <title>ASP.NET Example</title>
</head>
<body>
      <form id="form1" method="post" runat="server">
  
         <a href="http://www.microsoft.com" runat="server"> Enter site.</a>
  
      </form>
    </body>
 
 </html>

Commenti

Utilizzare questa proprietà per specificare l'URL a cui collegarsi quando si fa clic sul HtmlAnchor controllo .

Si applica a