Skip to main content

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

SQL Query 1)    Using CASE Statement : - To Check the Particular column ISNULL              CASE WHEN ISNULL ([Col_Name], ' ') = ' ' THEN 'Others'                       ELSE [Col_Name] END AS [Col_Name] 2)    Convert Data format into VARCHAR and save 10/18/2012 this Format and also check if Date Column is Empty or not.                 CONVERT (VARCHAR,[Col_CreatedDt], 101) AS CreatedDt                        , CASE WHEN ISNULL ([Col_ModifiedDt], ' ') = ' ' THEN ' not available'                        ELSE CONVERT (VARCHAR, [ Col_ModifiedDt], 101) END AS ModifiedDt 3)    Casting  and Check Date Difference               CAST (Col_Name or ParameterName AS VARCHAR)               DATEDIFF(HOUR,Col_Date, GETDATE())<=24 4)    Create two table and set Primary key and Foreign Key             Create Table Exams            (                 exam_id int primary key,                 exam_name varchar(50),            );    

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

Dynamically check the Particular name Folder exist or not, it not exits create folder dynamically. if (!Directory.Exists(FolderName))         {             Directory.CreateDirectory(FolderName);         }         if (Directory.Exists(FolderName))         {             string[] filePaths = Directory.GetFiles(FolderName);             foreach (string filePath in filePaths)                 File.Delete(filePath);             //Directory.Delete(FolderName);                    }