Compartilhar via


HyperLink.ImageUrl Propriedade

Definição

Obtém ou define o caminho para uma imagem a ser exibida para o controle de HyperLink.

public:
 virtual property System::String ^ ImageUrl { System::String ^ get(); void set(System::String ^ value); };
[System.ComponentModel.Bindable(true)]
public virtual string ImageUrl { get; set; }
[<System.ComponentModel.Bindable(true)>]
member this.ImageUrl : string with get, set
Public Overridable Property ImageUrl As String

Valor da propriedade

String

O caminho para a imagem a ser exibida para o controle de HyperLink. O valor padrão é uma cadeia de caracteres vazia ("").

Atributos

Exemplos

O exemplo a seguir demonstra como definir a ImageUrl propriedade para especificar o caminho para a imagem a ser exibida.

<%@ 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>HyperLink Example</title>
</head>
<body>
<form id="Form1" runat="server">

   <h3>HyperLink Example</h3>

   Click on the HyperLink:<br />  

   <asp:HyperLink id="hyperlink1" 
                  ImageUrl="images/pict.jpg"
                  NavigateUrl="http://www.microsoft.com"
                  Text="Microsoft Official Site"
                  Target="_new"
                  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>HyperLink Example</title>
</head>
<body>
<form id="Form1" runat="server">


   <h3>HyperLink Example</h3>

   Click on the HyperLink:<br />  

   <asp:HyperLink id="hyperlink1" 
                  ImageUrl="images/pict.jpg"
                  NavigateUrl="http://www.microsoft.com"
                  Text="Microsoft Official Site"
                  Target="_new"
                  runat="server"/>       
</form>
</body>
</html>

Comentários

O HyperLink controle pode ser exibido como texto ou imagem. Use a ImageUrl propriedade para especificar uma imagem a ser exibida para o HyperLink controle.

Observação

Se as propriedades e ImageUrl as Text propriedades estiverem definidas, a ImageUrl propriedade terá precedência. Se a imagem não estiver disponível, o texto na Text propriedade será exibido. Em navegadores que dão suporte à funcionalidade ToolTip, a Text propriedade também se torna a Dica de Ferramenta.

Aplica-se a

Confira também