We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How can I specify an image for a grid column header?

Platform: ASP.NET Web Forms (Classic) |
Control: GridGroupingControl |
Published Date: April 30, 2011 |
Last Revised Date: August 21, 2019

You can specify an image for a column header of a particular column via the Properties settings. Choose the Column via the TableDescriptor's Columns collection and set the ImageUrl property of the ColumnHeaderCell in the Appearance settings.

C#

this.GridGroupingControl1.TableDescriptor.Columns[0].Appearance.ColumnHeaderCell.ImageUrl = @"Images\Image1.PNG";

VB

Me.GridGroupingControl1.TableDescriptor.Columns(0).Appearance.ColumnHeaderCell.ImageUrl = "Images\Image1.PNG"

Additionally, if you also want to hide the text that will be displayed in the column header, take a look at the following code snippet. Note that you cannot set an empty text to the corresponding GridColumnDescriptor’s HeaderText property because the framework does not allow specifying empty text for column headers.

C#

private void GridGroupingControl1_QueryCellStyleInfo(object sender, Syncfusion.Web.UI.WebControls.Grid.Grouping.GridTableCellStyleInfoEventArgs e)

{

if(e.TableCellIdentity.TableCellType == GridTableCellType.ColumnHeaderCell)

{

if(e.Style.Text == "ColName")

e.Style.Text = String.Empty;

}

}

VB

Private Sub GridGroupingControl1_QueryCellStyleInfo(ByVal sender As Object, ByVal e As Syncfusion.Web.UI.WebControls.Grid.Grouping.GridTableCellStyleInfoEventArgs)

If e.TableCellIdentity.TableCellType = GridTableCellType.ColumnHeaderCell Then

If e.Style.Text = "ColName" Then

e.Style.Text = String.Empty

End If

End If

End Sub

ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon