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; }


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)


"border-collapse"] = "seperate";


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