user168507
user168507

Reputation: 881

asp.net: add attribute to headers th

I changed a gridview's header to ... with

    Sub MakeAccessible(ByVal grid As GridView)
    If grid.Rows.Count > 0 Then

        grid.UseAccessibleHeader = True
        grid.HeaderRow.TableSection = TableRowSection.TableHeader
        grid.HeaderRow.CssClass = ""
        'grid.FooterRow.TableSection = TableRowSection.TableFooter
    End If
End Sub

Now I need to add attributes to the th tags like th xyz=boom. How to do so?

Thx a lot for your help and interest...

Upvotes: 2

Views: 4423

Answers (2)

Michael Bold
Michael Bold

Reputation: 3

You can add the attribute to the header row by adding by adding the following to your sub

grid.HeaderRow.Cells[2].Attributes.Add("xyz", "boom")

Upvotes: 0

Pranay Rana
Pranay Rana

Reputation: 176896

Make use of Attributes.Add

Example

e.Row.Cells[1].Attributes.Add("class", "text")

Upvotes: 1

Related Questions