I am creating a SharePoint web part in C# and part of it outputs a GridView control to the page. While I can get fairly extensive control over the way it is displayed by setting the CSS class of the GridView itself, what I would really like to do is be able to specify classes to certain specific td elements. I'm not sure how to go about doing this, or if it would be done at the time that the GridView is being populated with rows, or at the time the GridView is added to the page.
In pseudocode, what I had essentially envisioned was to be able to say something like gridView.Row[4].CssClass = "header," which would set the td of the fifth row in the GridView to the class "header."
I've looked into using the RowDataBound event, so I just used the following to test it:
protected void outputGrid1_RowDataBound(object sender, GridViewRowEventArgs e)
{
e.Row.CssClass = "outputHeader";
}
It's probably my misunderstanding of how to use that properly, but it doesn't appear to do anything. I thought it would set all of the rows to the class "header," and if it had, I was going to work on my logic from there, but I can't even get that to work. Thanks for any help anyone can provide!