DetailsView.BackImageUrl DetailsView.BackImageUrl DetailsView.BackImageUrl DetailsView.BackImageUrl Property

Definizione

Ottiene o imposta l'URL di un'immagine da visualizzare sullo sfondo di un controllo DetailsView.Gets or sets the URL to an image to display in the background of a DetailsView control.

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

Valore della proprietà

L'URL di un'immagine da visualizzare sullo sfondo del controllo DetailsView.The URL to an image to display in the background of the DetailsView control. Il valore predefinito è una stringa vuota (""), a indicare che questa proprietà non è impostata.The default is an empty string (""), which indicates that this property is not set.

Esempi

Nell'esempio di codice riportato di seguito viene illustrato BackImageUrl come utilizzare la proprietà per visualizzare un'immagine personalizzata sullo sfondo DetailsView di un controllo.The following code example demonstrates how to use the BackImageUrl property to display a custom image in the background of a DetailsView control. Per il corretto funzionamento di questo esempio, è necessario fornire un'immagine personalizzata.You must provide your own image for this example to work.


<%@ Page language="C#" %>

<!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>DetailsView BackImageUrl Example</title>
</head>
<body>
    <form id="Form1" runat="server">
        
      <h3>DetailsView BackImageUrl Example</h3>
                
        <asp:detailsview id="CustomerDetailView"
          datasourceid="DetailsViewSource"
          datakeynames="CustomerID"
          autogeneraterows="true"
          allowpaging="true"
          backimageurl="~\images\BackgroundImage.jpg"   
          runat="server">
               
          <headerstyle backcolor="Navy"
            forecolor="White"/>
                    
        </asp:detailsview>
        
        <!-- This example uses Microsoft SQL Server and connects  -->
        <!-- to the Northwind sample database. Use an ASP.NET     -->
        <!-- expression to retrieve the connection string value   -->
        <!-- from the web.config file.                            -->
        <asp:SqlDataSource ID="DetailsViewSource" runat="server" 
          ConnectionString=
            "<%$ ConnectionStrings:NorthWindConnectionString%>"
          InsertCommand="INSERT INTO [Customers]([CustomerID], 
            [CompanyName], [Address], [City], [PostalCode], [Country]) 
            VALUES (@CustomerID, @CompanyName, @Address, @City, 
            @PostalCode, @Country)"
          SelectCommand="Select [CustomerID], [CompanyName], 
            [Address], [City], [PostalCode], [Country] 
             From [Customers]">
        </asp:SqlDataSource>
    </form>
  </body>
</html>


<%@ Page language="VB" %>

<!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>DetailsView BackImageUrl Example</title>
</head>
<body>
    <form id="Form1" runat="server">
        
      <h3>DetailsView BackImageUrl Example</h3>
                
        <asp:detailsview id="CustomerDetailView"
          datasourceid="DetailsViewSource"
          datakeynames="CustomerID"
          autogeneraterows="true"
          allowpaging="true"
          backimageurl="~\images\BackgroundImage.jpg"   
          runat="server">
               
          <headerstyle backcolor="Navy"
            forecolor="White"/>
                    
        </asp:detailsview>
        
        <!-- This example uses Microsoft SQL Server and connects  -->
        <!-- to the Northwind sample database. Use an ASP.NET     -->
        <!-- expression to retrieve the connection string value   -->
        <!-- from the web.config file.                            -->
        <asp:SqlDataSource ID="DetailsViewSource" runat="server" 
          ConnectionString=
            "<%$ ConnectionStrings:NorthWindConnectionString%>"
          InsertCommand="INSERT INTO [Customers]([CustomerID], 
            [CompanyName], [Address], [City], [PostalCode], [Country]) 
            VALUES (@CustomerID, @CompanyName, @Address, @City, 
            @PostalCode, @Country)"
          SelectCommand="Select [CustomerID], [CompanyName], 
            [Address], [City], [PostalCode], [Country] 
            From [Customers]">
        </asp:SqlDataSource>
    </form>
  </body>
</html>

Commenti

Utilizzare la BackImageUrl proprietà per specificare l'URL di un'immagine da visualizzare sullo sfondo di un DetailsView controllo.Use the BackImageUrl property to specify the URL to an image to display in the background of a DetailsView control.

Nota

Se l'immagine specificata è più piccola DetailsView del controllo, viene affiancata l'immagine per riempire lo sfondo.If the specified image is smaller than the DetailsView control, the image is tiled to fill in the background. Se l'immagine è più grande del controllo, l'immagine viene ritagliata.If the image is larger than the control, the image is cropped.

Si applica a

Vedi anche