GridView.BackImageUrl Właściwość

Definicja

Pobiera lub ustawia adres URL na obraz, aby był wyświetlany w tle kontrolki GridView .

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

Wartość właściwości

String

Adres URL obrazu do wyświetlenia w tle kontrolki GridView . Wartość domyślna to pusty ciąg (""), który wskazuje, że ta właściwość nie jest ustawiona.

Przykłady

W poniższym przykładzie pokazano, jak używać BackImageUrl właściwości do wyświetlania obrazu niestandardowego w tle kontrolki GridView .


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

Uwagi

BackImageUrl Użyj właściwości , aby określić adres URL obrazu do wyświetlenia w tle kontrolkiGridView.

Uwaga

Jeśli określony obraz jest mniejszy niż kontrolka GridView , obraz jest kafelek, aby wypełnić tło. Jeśli obraz jest większy niż kontrolka, obraz zostanie przycięty.

Dotyczy

Zobacz też