DataControlField.HeaderImageUrl Właściwość

Definicja

Pobiera lub ustawia adres URL obrazu wyświetlanego w elemencie nagłówka pola kontrolki danych.

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

Wartość właściwości

String

Ciąg reprezentujący w pełni kwalifikowany lub względny adres URL obrazu wyświetlanego w elemencie nagłówka DataControlFieldelementu .

Przykłady

W poniższym przykładzie kodu pokazano, jak deklaratywnie ustawić HeaderImageUrl właściwość ButtonField kolumny, która wyświetla obraz w GridView nagłówku kolumny kontrolki zamiast tekstu nagłówka.

<%@ 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>ASP.NET Example</title>
</head>
<body>
  <form id="form1" runat="server">
    <asp:sqldatasource
      id="SqlDataSource1"
      runat="server"
      connectionstring="<%$ ConnectionStrings:MyNorthwind%>"
      selectcommand="SELECT EmployeeID, FirstName, LastName, Title, Region FROM Employees">
    </asp:sqldatasource>

    <asp:gridview
      id="GridView1"
      runat="server"
      allowpaging="True"
      datasourceid="SqlDataSource1"
      allowsorting="True"
      width="472px">
        <columns>

          <asp:buttonfield
            headerimageurl="http://www.microsoft.com/homepage/gif/bnr-microsoft.gif"
            text="ClickMe"
            showheader="True"
            buttontype="Button">
          </asp:buttonfield>

        <asp:hyperlinkfield
          target="http://msdn.microsoft.com/"
          headertext="Link To Info"
          text="MyLink">
            <headerstyle backcolor="Yellow">
            </headerstyle>
        </asp:hyperlinkfield>

      </columns>
    </asp:gridview>

  </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>ASP.NET Example</title>
</head>
<body>
  <form id="form1" runat="server">
    <asp:sqldatasource
      id="SqlDataSource1"
      runat="server"
      connectionstring="<%$ ConnectionStrings:MyNorthwind%>"
      selectcommand="SELECT EmployeeID, FirstName, LastName, Title, Region FROM Employees">
    </asp:sqldatasource>

    <asp:gridview
      id="GridView1"
      runat="server"
      allowpaging="True"
      datasourceid="SqlDataSource1"
      allowsorting="True"
      width="472px">
        <columns>

          <asp:buttonfield
            headerimageurl="http://www.microsoft.com/homepage/gif/bnr-microsoft.gif"
            text="ClickMe"
            showheader="True"
            buttontype="Button">
          </asp:buttonfield>

        <asp:hyperlinkfield
          target="http://msdn.microsoft.com/"
          headertext="Link To Info"
          text="MyLink">
            <headerstyle backcolor="Yellow">
            </headerstyle>
        </asp:hyperlinkfield>

      </columns>
    </asp:gridview>

  </form>
</body>
</html>

Uwagi

HeaderImageUrl Ustaw właściwość, gdy chcesz wyświetlić obraz w elemencie nagłówka kontrolki danych zamiast tekstu nagłówka.

Uwaga

HeaderText Jeśli właściwości i HeaderImageUrl są ustawione, HeaderImageUrl właściwość ma pierwszeństwo.

Dotyczy

Zobacz też