protected void ibtnExportPDFAppTableDoc_Click(object sender, ImageClickEventArgs e) { GridDuplicacy.AllowPaging = false; GridDuplicacy.DataSource = function(); GridDuplicacy.DataBind(); if (GridDuplicacy.Rows.Count > 0) { GridDuplicacy.Columns[7].Visible = false; GridDuplicacy.Columns[8].Visible = false; Response.ContentType = "application/pdf"; Response.AddHeader("content-disposition", "attachment;filename=Subscription.pdf"); Response.Cache.SetCacheability(HttpCacheability.NoCache); StringWriter sw = new StringWriter(); HtmlTextWriter hw = new HtmlTextWriter(sw); GridDuplicacy.RenderControl(hw); StringReader sr = new StringReader(sw.ToString()); Document pdfDoc = new Document(PageSize.A4, 10f, 10f, 10f, 0f); HTMLWorker htmlparser = new HTMLWorker(pdfDoc); PdfWriter.GetInstance(pdfDoc, Response.OutputStream); pdfDoc.Open(); htmlparser.Parse(sr); pdfDoc.Close(); Response.Write(pdfDoc); Response.End(); } }
protected void ibtnExportExcelAppTableDoc_Click(object sender, ImageClickEventArgs e) { GridDuplicacy.AllowPaging = false; GridDuplicacy.DataSource = function(); GridDuplicacy.DataBind(); if (GridDuplicacy.Rows.Count > 0) { GridDuplicacy.Columns[7].Visible = false; GridDuplicacy.Columns[8].Visible = false; Response.Clear(); Response.Buffer = true; Response.AddHeader("content-disposition", "attachment;filename=Subscription.xls"); Response.Charset = ""; Response.ContentType = "application/vnd.ms-excel"; StringWriter sw = new StringWriter(); HtmlTextWriter hw = new HtmlTextWriter(sw); GridDuplicacy.RenderControl(hw); string style = @"<style> .textmode { mso-number-format:\@; } </style>"; Response.Write(style); Response.Output.Write(sw.ToString()); Response.Flush(); Response.End(); } }
protected void Page_Load(object sender, EventArgs e) { try { if (Convert.ToString(MyLogin.login[0]) == "") { Response.Redirect("../Login.aspx"); } else { if (!IsPostBack) { ddlType.SelectedValue = "All"; ddlStatus.SelectedValue = "Registered"; clsstatecity.xmlstate(ddlState, "XMLState.xml"); clsstatecity.xmlCity(ddlCity, ddlState.SelectedItem.Text.ToString(), "XMLState.xml"); txtIMID.Text = Request.QueryString["id"].ToString(); if (Request.QueryString["id"] == "") { panelProfile.Visible = false; panelInspection.Visible = false; panelChangeStatus.Visible = false; panelSubscribe.Visible = false; } else { panelProfile.Visible = true; showprofile(Request.QueryString["id"]); } maikal dev = new maikal(); int se = dev.chksession(); if (se == 0) { ddlsession.SelectedValue = "Sum"; ddlSessionFrom.SelectedValue = "Sum"; } else { ddlsession.SelectedValue = "Win"; ddlSessionFrom.SelectedValue = "Win"; } txtSession.Text = DateTime.Now.Year.ToString(); txtYearFrom.Text = DateTime.Now.Year.ToString(); lblSessionHiddend.Text = ddlsession.SelectedValue.ToString() + "" + txtSession.Text.ToString(); SqlDataAdapter ad = new SqlDataAdapter("select ID,Name,Address,State,Email,Type,RegDate,YearFrom from Member where Active='Registered' or Active='Register'", con); DataSet ds = new DataSet(); ad.Fill(ds); GridDuplicacy.DataSource = ds; GridDuplicacy.DataBind(); lblInspectionNo.Text = "0"; maikal devnagar = new maikal(); int lvl = devnagar.returnlevel(MyLogin.login[1].ToString(), MyLogin.login[0].ToString()); if (lvl == 2) { panelChangeStatus.Enabled = false; panelSubscribe.Enabled = false; } txtAddress.Focus(); } } } catch (NullReferenceException ex) { Response.Redirect("../Login.aspx"); } }
// To be Expire IM. private void ToBeExpireIM() { SqlDataAdapter ad = new SqlDataAdapter("select ID,Name,Designation,Address,State,Email,RegDate, RenewDate, ExpDate from Member where RenewDate<='" + DateTime.Now + "'", con); DataSet ds = new DataSet(); ad.Fill(ds); GridDuplicacy.DataSource = ds; GridDuplicacy.DataBind(); //if (GridDuplicacy.Rows.Count > 0) //{ // for (int i = 0; i < GridDuplicacy.Rows.Count; i++) // { // GridDuplicacy.Rows[i].Cells[7].Text = Convert.ToDateTime(GridDuplicacy.Rows[i].Cells[7].Text).ToString("dd/MM/yyyy"); // GridDuplicacy.Rows[i].Cells[8].Text = Convert.ToDateTime(GridDuplicacy.Rows[i].Cells[8].Text).ToString("dd/MM/yyyy"); // GridDuplicacy.Rows[i].Cells[9].Text = Convert.ToDateTime(GridDuplicacy.Rows[i].Cells[9].Text).ToString("dd/MM/yyyy"); // } //} }
protected void ibtnExportDocAppTableDoc_click(object sender, ImageClickEventArgs e) { GridDuplicacy.AllowPaging = false; GridDuplicacy.DataSource = fillgrid(); GridDuplicacy.DataBind(); if (GridDuplicacy.Rows.Count > 0) { GridDuplicacy.Columns[0].Visible = false; Response.Clear(); Response.Buffer = true; Response.AddHeader("content-disposition", "attachment;filename=Inspection.doc"); Response.Charset = ""; Response.ContentType = "application/vnd.ms-word "; StringWriter sw = new StringWriter(); HtmlTextWriter hw = new HtmlTextWriter(sw); GridDuplicacy.RenderControl(hw); Response.Output.Write(sw.ToString()); Response.Flush(); Response.End(); } }
protected void GridDuplicacy_PageIndexChanging(object sender, GridViewPageEventArgs e) { GridDuplicacy.PageIndex = e.NewPageIndex; GridDuplicacy.DataSource = function(); GridDuplicacy.DataBind(); }
protected void Button1_Click(object sender, EventArgs e) { GridDuplicacy.DataSource = function(); GridDuplicacy.DataBind(); }
protected void btnViewGrid_Onclick(object sender, EventArgs e) { GridDuplicacy.DataSource = fillgrid(); GridDuplicacy.DataBind(); }