I am trying to apply CSS in asp.net Gridview to make its look and feel good, just like bootstrap css.
Below is the code with css:
HTML
<asp:GridView ID="GridView1" runat="server" CssClass="table table-bordered table-hover" AllowPaging="True"
OnPageIndexChanging="OnPageIndexChanging" PageSize="5">
<PagerStyle CssClass="pagination-ys" />
</asp:GridView>
C#
protected void Page_Load(object sender, EventArgs e)
{
List<ClassMgmtRegion> dpt = new List<ClassMgmtRegion>()
{
new ClassMgmtRegion(){
No=1,
Name="Sabah",
Code="PMO",
Latitude="",
Longitude=""
},
new ClassMgmtRegion(){
No=1,
Name="Sarawak",
Code="PMO2",
Latitude="",
Longitude=""
},
new ClassMgmtRegion(){
No=1,
Name="Terenggaun",
Code="PMO3",
Latitude="",
Longitude=""
},
new ClassMgmtRegion(){
No=1,
Name="Sabah",
Code="PMO4",
Latitude="",
Longitude=""
}
};
GridView1.DataSource = dpt;
GridView1.DataBind();
}
protected void OnPageIndexChanging(object sender, GridViewPageEventArgs e)
{
GridView1.PageIndex = e.NewPageIndex;
GridView1.DataBind();
}
CSS
/*-----Gridview Style-----*/
.pagination-ys {
padding-left: 0;
margin: 20px 0;
border-radius: 4px;
}
.pagination-ys table > tbody > tr > td {
display: inline;
}
.pagination-ys table > tbody > tr > td > a,
.pagination-ys table > tbody > tr > td > span {
position: relative;
float: left;
padding: 8px 12px;
line-height: 1.42857143;
text-decoration: none;
color: black;
background-color: #ffffff;
border: 1px solid #dddddd;
margin-left: -1px;
}
.pagination-ys table > tbody > tr > td > span {
position: relative;
float: left;
padding: 8px 12px;
line-height: 1.42857143;
text-decoration: none;
margin-left: -1px;
z-index: 2;
color: white;
background-color: #11AEA3;
border-color: #dddddd;
cursor: default;
}
.pagination-ys table > tbody > tr > td:first-child > a,
.pagination-ys table > tbody > tr > td:first-child > span {
margin-left: 0;
border-bottom-left-radius: 4px;
border-top-left-radius: 4px;
}
.pagination-ys table > tbody > tr > td:last-child > a,
.pagination-ys table > tbody > tr > td:last-child > span {
border-bottom-right-radius: 4px;
border-top-right-radius: 4px;
}
.pagination-ys table > tbody > tr > td > a:hover,
.pagination-ys table > tbody > tr > td > span:hover,
.pagination-ys table > tbody > tr > td > a:focus,
.pagination-ys table > tbody > tr > td > span:focus {
color: black;
background-color: #eeeeee;
border-color: #dddddd;
}
But the Header part of Griview looks like rows using above CSS.
I want to make Gridview header text bold with some background color in it, to differentiate the Gridview Header with Gridview Rows.
I want to use bootstrap css to make Gridview look stylish.
Please help me how to achieve that using my CSS.
Thanks in advance