Title: attendance code                                 If you need copy same format use firefox or chrome or safari but iexplorer not work


Preview of Code
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="attendance.aspx.cs" Inherits="attendance" %>
 
<!DOCTYPE html>
 
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div style="margin:0px auto;width:50%;direction:rtl">
     <!-- title -->
        <div style="text-align:center;font-size:22px;margin:0px auto;width:600px;align-content:center">استعلام عن الحضور والغياب والتاخير </div>
        <!-- main query -->
        <div>
            <table style="margin:20px auto">
                <tr><td>
                    <asp:Label ID="Label1" style="font-weight:bolder" runat="server" Text="رقم الوظيفي"></asp:Label>
                    </td>
 
                    <td> <asp:TextBox ID="txtemp_no" runat="server" Width="214px">456</asp:TextBox></td>
                    <td> <asp:Button ID="Button1" runat="server" Text="ارسال" Width="87px" OnClick="Button1_Click" /></td>
                </tr>
                <tr>
                    <td>
                    <asp:Label ID="Label2" style="font-weight:bolder" runat="server" Text="من تاريخ"></asp:Label>
                    </td>
                    <td> <asp:TextBox ID="txtfromdate" runat="server" Width="214px">01-06-1435</asp:TextBox></td>
                    <td>
                    <asp:Label ID="Label3" style="font-weight:bolder" runat="server" Text="الى تاريخ"></asp:Label>
                    </td>
                    <td> <asp:TextBox ID="txttodate" runat="server" Width="214px">10-06-1435</asp:TextBox></td>
                </tr>
               <tr>
                    <td>
                    <asp:Label ID="Label4" style="font-weight:bolder" runat="server" Text="اسم الموظف"></asp:Label>
                    </td>
                    <td>  <asp:Label ID="lblemp_name" style="font-weight:bolder" runat="server" Text=""></asp:Label></td>
                    <td>
                    <asp:Label ID="Label5" style="font-weight:bolder" runat="server" Text="اسم القسم"></asp:Label>
                    </td>
                    <td> 
                    <asp:Label ID="lbldept_name" style="font-weight:bolder" runat="server" Text=""></asp:Label>
                    </td>
                </tr>
                <tr><td>
                    <asp:Literal ID="lblmsg" runat="server"></asp:Literal></td></tr>
             </table>
             <!-- Gridview query -->
<div style="border: 1px solid blue">
    <asp:GridView AllowPaging="True"  PageSize="18" DataKeyNames="emp_no" OnRowDataBound="GridView1_RowDataBound" ID="GridView1" runat="server" BackColor="Tan" BorderColor="Wheat" BorderStyle="None" BorderWidth="1px" CellPadding="2" AutoGenerateColumns="False" Width="100%" OnRowCommand="GridView1_RowCommand" OnPageIndexChanging="GridView1_PageIndexChanging">
         <PagerSettings PageButtonCount="18" />
        <RowStyle BackColor="White" ForeColor="#333333" />
           <Columns>
            <asp:BoundField DataField="emp_no" HeaderText="رقم الموظف" >
               <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="50px" />
               </asp:BoundField>
            <asp:BoundField DataField="s_date_txt" HeaderText="التاريخ" >
        
               <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="60px" />
               </asp:BoundField>
        
            <asp:BoundField DataField="LATE_MNIT" HeaderText="دقائق التاخير" ItemStyle-Width="10px" >
<ItemStyle Width="10px"></ItemStyle>
               </asp:BoundField>
            <asp:TemplateField HeaderText="خروج بدون اذن">
              
                <ItemTemplate>
                    <asp:Label Visible="false" ID="lblillegal" runat="server" Text=`<%# Bind("ILLEGAL_EXIT") %>`></asp:Label>
                      <asp:Image style="text-align:center" ID="imgID0" runat="server" Width="30px" ImageAlign="Middle" />
                </ItemTemplate>
                <ControlStyle Width="40px" />
                <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="40px" />
            </asp:TemplateField>
            <asp:TemplateField HeaderText="عدم توقيع انصراف">
               
                <ItemTemplate>
                    <asp:Label Visible="false" ID="lblNO_SIGN" runat="server" Text=`<%# Bind("NO_SIGN") %>`></asp:Label>
                      <asp:Image ID="imgID1" runat="server" Width="30px" />
                </ItemTemplate>
                <ControlStyle Width="40px" />
                <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="40px" />
            </asp:TemplateField>
            <asp:TemplateField HeaderText="غياب">
             
                <ItemTemplate>
                    <asp:Label Visible="false" ID="lblABSENCE" runat="server" Text=`<%# Bind("ABSENCE") %>`></asp:Label>
                    <asp:Image ID="imgID00" runat="server" Width="30px" />
                </ItemTemplate>
                <ControlStyle Width="40px" />
                <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="40px" />
            </asp:TemplateField>
        </Columns>
         <FooterStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="#cfcfcf" />
                              <PagerStyle BackColor="#3099fa" ForeColor="White" HorizontalAlign="Center" />
                              <SelectedRowStyle BackColor="#C5BBAF" Font-Bold="True" ForeColor="#3099fa" />
                              <HeaderStyle BackColor="#b5dbff" Font-Bold="True" ForeColor="#055689" />
                              <EditRowStyle BackColor="#7C6F57" />
                              <AlternatingRowStyle BackColor="White" />
    </asp:GridView>
</div>
        </div>
    </div>
    </form>
</body>
</html>
 
 
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using mydatasetTableAdapters;
 
public partial class attendance : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
 
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
 
        //try
        //{
 
        mydatasetTableAdapters.ATTENDANCETableAdapter adp = new mydatasetTableAdapters.ATTENDANCETableAdapter();
        mydataset.ATTENDANCEDataTable dt = new mydataset.ATTENDANCEDataTable();
        dt = adp.GetDataBy_att(txtfromdate.Text.Trim(), txttodate.Text.Trim(), Convert.ToDecimal(txtemp_no.Text.Trim()));
 
        mydataset ds = new mydataset();
        ds.ATTENDANCE.Clear();
        adp.FillBy_att(ds.ATTENDANCE, txtfromdate.Text.Trim(), txttodate.Text.Trim(), Convert.ToDecimal(txtemp_no.Text.Trim()));
 
        if (ds.ATTENDANCE.Count > 0)
        {
            lbldept_name.Text = dt[0].DPT_DESC.ToString();
            lblemp_name.Text = dt[0].EMP_NAME.ToString();
            
            GridView1.DataSource = ds.ATTENDANCE.DefaultView;
            GridView1.DataBind();
  }
     // }
        //catch
        //{
 
        //    lblmsg.Text = "حدث خطا اثناء تنفيذ البرنامج";
        //}
    }
    protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
 
                //foreach (GridViewRow row in GridView1.Rows)
                for (int i = 0; i < GridView1.Rows.Count; i++)
                {
                    GridViewRow row = GridView1.Rows[i];
 
                    Image img0 = (Image)e.Row.FindControl("imgID0");
                    if (((Label)row.FindControl("lblillegal")).Text.ToString() == "0" || ((Label)row.FindControl("lblillegal")).Text.ToString() == "")
                        img0.ImageUrl = "~/images/true.png";
                    else
                        img0.ImageUrl = "~/images/false.png";
 
                    Image img1 = (Image)e.Row.FindControl("imgID1");
                    if (((Label)row.FindControl("lblNO_SIGN")).Text.ToString() == "0" || ((Label)row.FindControl("lblNO_SIGN")).Text.ToString() == "")
                        img1.ImageUrl = "~/images/true.png";
                    else
                        img1.ImageUrl = "~/images/false.png";
 
                    Image img2 = (Image)e.Row.FindControl("imgID00");
                    if (((Label)row.FindControl("lblABSENCE")).Text.ToString() == "0" || ((Label)row.FindControl("lblABSENCE")).Text.ToString() == "")
                        img2.ImageUrl = "~/images/true.png";
                    else
                        img2.ImageUrl = "~/images/false.png";
                }
            }
      }
 
    protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        int rowIndex = Convert.ToInt32(e.CommandArgument);
 
 
        foreach (GridViewRow row in GridView1.Rows)
        {
            row.BackColor = row.RowIndex.Equals(rowIndex) ?
                System.Drawing.Color.Red :
                System.Drawing.Color.White;
        }
    }
    protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
         GridView1.DataBind();
         GridView1.PageIndex = e.NewPageIndex;
    }
}