GridView Design Using CSS

 Create Css File in your Project...And Add Reference to Grid View page
* {
    padding: 0;
    margin: 0;
}
body {
    font: 11px Tahoma;
    background-color: #F7F7E9;
}
h1 {
    font: bold 32px Times;
    color: #666;
    text-align: center;
    padding: 20px 0;   
}
#container {
    width: 700px;
    margin: 10px auto;
}

.mGrid 
{
    width: 100%;
    background-color: #fff;
    margin: 5px 0 10px 0;
    border: solid 1px #525252;
    border-collapse:collapse;
}
.mGrid td
{
   padding: 2px;
   border: solid 1px #c1c1c1;
   color: #717171;
}
.mGrid th
{
    padding: 4px 2px;
    color: #fff;
    background: #424242 url(grd_head.png) repeat-x top;
    border-left: solid 1px #525252;
    font-size: 0.9em;
}
.mGrid .alt
{
    background: #fcfcfc url(grd_alt.png) repeat-x top;
}
.mGrid .pgr
{
    background: #424242 url(grd_pgr.png) repeat-x top;
}
.mGrid .pgr table
{
    margin: 5px 0;
}
.mGrid .pgr td
{
    border-width: 0;
    padding: 0 6px;
    border-left: solid 1px #666;
    font-weight: bold; color: #fff;
    line-height: 12px;
}  
.mGrid .pgr a
{
    color: #666;
    text-decoration: none;
}
.mGrid .pgr a:hover
{
    color: #000;
    text-decoration: none;
}

Grid View Page......In This Page have to call CssClass="mGrid" in GridView Contro..
Eg...
<div id="container">
        <h1>ASP.NET GridView makeover using CSS</h1>
   
        <asp:GridView ID="gvCustomres" runat="server"
            DataSourceID="customresDataSource"
            AutoGenerateColumns="False"
            GridLines="None"
            AllowPaging="true"
            CssClass="mGrid"
            PagerStyle-CssClass="pgr"
            AlternatingRowStyle-CssClass="alt">
            <Columns>

           BIND THE DATA HERE
          </Columns>
         </GridView>




Save it Above image to Css folder...Give the name grd_alt.png ,grd_head.png, and grd_pgr.png

Comments

Popular posts from this blog

SQL Query :- Create Tables,Primary key,Foreign key,Merge Statment

AngularJS

Check folder and Delete All Files from Existing Folder in C#