DataControlField.HeaderImageUrl Property
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets or sets the URL of an image that is displayed in the header item of a data control field.
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
A string that represents a fully qualified or relative URL to an image that is displayed in the header item of the DataControlField.
The following code example demonstrates how to declaratively set the HeaderImageUrl property of a ButtonField column, which displays an image in the GridView control's column header instead of header text.
<%@ 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>
Set the HeaderImageUrl property when you want an image displayed in the header item of a data control instead of header text.
Napomena
If both the HeaderText and HeaderImageUrl properties are set, the HeaderImageUrl property has precedence.
Proizvod | Verzije |
---|---|
.NET Framework | 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
Povratne informacije o proizvodu .NET
.NET je projekt otvorenog koda. Odaberite vezu za slanje povratnih informacija: