Exemplo n.º 1
0
 protected void AuditLogDetails_PageIndexChanging(object sender, GridViewPageEventArgs e)
 {
     GrdAuditLogDetails.PageIndex = e.NewPageIndex;
     GrdAuditLogDetails.DataBind();
     DisplayAuditLogdetails();
     GrdAuditLogDetails.SelectedRowStyle.Reset();
 }
Exemplo n.º 2
0
 protected void AuditLogDetails_PageIndexChanged1(object sender, EventArgs e)
 {
     GrdAuditLogDetails.DataBind();
     DisplayAuditLogdetails();
     if (GrdAuditLogDetails.Rows.Count > 1)
     {
         lblPageInfo.Text = String.Format("Viewing Page {0} of {1}", GrdAuditLogDetails.PageIndex + 1, GrdAuditLogDetails.PageCount);
     }
     GrdAuditLogDetails.SelectedRowStyle.Reset();
 }
Exemplo n.º 3
0
 public bool DisplayAuditLogdetails()
 {
     try
     {
         PPRDataBL obj = new PPRDataBL();
         DataTable dt  = new DataTable();
         dt = obj.GetAuditLogDetaisBL(Session["LoginId"].ToString());
         GrdAuditLogDetails.DataSource = dt;
         GrdAuditLogDetails.DataBind();
     }
     catch (Exception ex)
     {
         LogError(ex);
     }
     return(false);
 }
Exemplo n.º 4
0
    protected void btnExportExcel_Click(object sender, EventArgs e)
    {
        // Clear all content output from the buffer stream
        Response.ClearContent();
        // Specify the default file name using "content-disposition" RESPONSE header
        Response.AppendHeader("content-disposition", "attachment; filename=AuditLoginDetails " + DateTime.Now + ".xls");
        // Set excel as the HTTP MIME type
        Response.ContentType = "application/excel";
        // Create an instance of stringWriter for writing information to a string
        System.IO.StringWriter stringWriter = new System.IO.StringWriter();
        // Create an instance of HtmlTextWriter class for writing markup
        // characters and text to an ASP.NET server control output stream
        HtmlTextWriter htw = new HtmlTextWriter(stringWriter);

        // Set white color as the background color for gridview header row
        GrdAuditLogDetails.HeaderRow.Style.Add("background-color", "#FFFFFF");

        // Set background color of each cell of GridView1 header row
        foreach (TableCell tableCell in GrdAuditLogDetails.HeaderRow.Cells)
        {
            tableCell.Style["background-color"] = "#A55129";
        }

        // Set background color of each cell of each data row of GridView1
        foreach (GridViewRow gridViewRow in GrdAuditLogDetails.Rows)
        {
            gridViewRow.BackColor = System.Drawing.Color.White;
            foreach (TableCell gridViewRowTableCell in gridViewRow.Cells)
            {
                gridViewRowTableCell.Style["background-color"] = "#FFF7E7";
            }
        }

        GrdAuditLogDetails.RenderControl(htw);
        Response.Write(stringWriter.ToString());
        Response.End();
    }