Work with GridView Header border through CSS

1. Define the border style for the TH element which represents the header for the Gridview:

<style type="text/css">.myheader th { background-color:Blue; border-color:Black; border-style:solid; border-width:2; color:White; }

</style>

2. And overide in the GridView’s PreRender event to replace the default style="border-collapse:collapse;"protected void GridView1_OnPreRender(object sender, EventArgs e)

{GridView1.Style[

"border-collapse"] = "seperate";

}

3. in your gridview, set HeaderStyle-CssClass="myheader" .

 

Advertisements