GridView.BackImageUrl Proprietà

Definizione

Ottiene o imposta l'URL di un'immagine da visualizzare sullo sfondo di un controllo GridView.Gets or sets the URL to an image to display in the background of a GridView 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à

URL di un'immagine da visualizzare sullo sfondo del controllo GridView.The URL of an image to display in the background of the GridView 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 seguente viene illustrato come utilizzare la BackImageUrl proprietà per visualizzare un'immagine personalizzata sullo sfondo di un GridView controllo.The following example demonstrates how to use the BackImageUrl property to display a custom image in the background of a GridView control.


<%@ 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>GridView BackImageUrl Example</title>
</head>
<body>
    <form id="form1" runat="server">
        
      <h3>GridView BackImageUrl Example</h3>

      <asp:gridview id="CustomersGridView" 
        datasourceid="CustomersSource" 
        autogeneratecolumns="true"
        emptydatatext="No data available." 
        backimageurl="~/images/logo.jpg" 
        runat="server">
                
      </asp:gridview>
            
      <!-- 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="CustomersSource"
        selectcommand="Select [CustomerID], [CompanyName], [Address], [City], [PostalCode], [Country] From [Customers]"
        connectionstring="<%$ ConnectionStrings:NorthWindConnectionString%>" 
        runat="server"/>
        
    </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>GridView BackImageUrl Example</title>
</head>
<body>
    <form id="form1" runat="server">
        
      <h3>GridView BackImageUrl Example</h3>

      <asp:gridview id="CustomersGridView" 
        datasourceid="CustomersSource" 
        autogeneratecolumns="true"
        emptydatatext="No data available." 
        backimageurl="~/images/logo.jpg" 
        runat="server">
                
      </asp:gridview>
            
      <!-- 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="CustomersSource"
        selectcommand="Select [CustomerID], [CompanyName], [Address], [City], [PostalCode], [Country] From [Customers]"
        connectionstring="<%$ ConnectionStrings:NorthWindConnectionString%>" 
        runat="server"/>
        
    </form>
  </body>
</html>

Commenti

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

Nota

Se l'immagine specificata è più piccola GridView del controllo, viene affiancata l'immagine per riempire lo sfondo.If the specified image is smaller than the GridView 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