Share via


HyperLink.ImageUrl Propriété

Définition

Obtient ou définit le chemin d'accès à une image à afficher pour le contrôle 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

Valeur de propriété

String

Chemin d'accès à l'image à afficher pour le contrôle HyperLink. La valeur par défaut est une chaîne vide ("").

Attributs

Exemples

L’exemple suivant montre comment définir la ImageUrl propriété pour spécifier le chemin d’accès à l’image à afficher.

<%@ 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>

Remarques

Le HyperLink contrôle peut être affiché sous forme de texte ou d’image. Utilisez la ImageUrl propriété pour spécifier une image à afficher pour le HyperLink contrôle.

Notes

Si les propriétés et ImageUrl les Text propriétés sont définies, la ImageUrl propriété est prioritaire. Si l’image n’est pas disponible, le texte de la Text propriété s’affiche. Dans les navigateurs qui prennent en charge la fonctionnalité Info-bulle, la Text propriété devient également l’Info-bulle.

S’applique à

Voir aussi