Articles in this section
Category / Section

How can I specify image for grid column header in ASP.NET(Classic)?

4 mins read

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

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied