I am trying to style my GridView object but I can't seem to get it to use the CSS class. I am creating the GridViews dynamically, so they are all created in code-behind. I have tried the following and nothing seems to work.
for (...)
{
GridView gv = new GridView();
gv.CssClass = "aclass";
gv.Attributes.Add("class", "aclass");
}
and also in the RowDataBound event:
foreach (row in gv)
e.Row.Cells[i].CssClass = "aClass";
and yet I still cannot style my data. Any advice is greatly appreciated
Page load,Init?Page_Initmethod. Dynamic controls should not be created on the page load, because of the page lifecycle.