protected void btnExportPDF_Click(object sender, EventArgs e)
        {
            try
            {
                DataTable objDataTable    = new DataTable();
                string    SelectedColumns = string.Empty;
                for (int i = 0; i < grddata.Columns.Count; i++)
                {
                    if (SelectedColumns == string.Empty)
                    {
                        SelectedColumns = SelectedColumns + "[" + grddata.Columns[i].HeaderText + "]";
                    }
                    else
                    {
                        SelectedColumns = SelectedColumns + "," + "[" + grddata.Columns[i].HeaderText + "]";
                    }
                }
                SelectedColumns = SelectedColumns.Replace(",[Delete]", " ");

                objDataTable = BeanHelper.SearchBean.GetData(ViewState["SearchCondition"].ToString() + ViewState["OrderBy"].ToString(), SelectedColumns);

                PDFWrite objPDFWrite = new PDFWrite();
                objPDFWrite.ExportPDF(objDataTable, (float[])ViewState["PDFColWidth"]);
            }
            catch (Exception ex)
            {
                Messagesection.Visible = true;
                Message.Text           = ex.Message;
                LogManager.Log(ex);
            }
        }
示例#2
0
        protected void btnExportPDF_ProductRedeem_Click(object sender, EventArgs e)
        {
            try
            {
                string SelectedColumns = string.Empty;
                for (int i = 0; i < grdProductRedeemGet.Columns.Count; i++)
                {
                    if (!string.IsNullOrEmpty(grdProductRedeemGet.Columns[i].HeaderText))
                    {
                        if (SelectedColumns == string.Empty)
                        {
                            SelectedColumns = SelectedColumns + "[" + grdProductRedeemGet.Columns[i].HeaderText + "]";
                        }
                        else
                        {
                            SelectedColumns = SelectedColumns + "," + "[" + grdProductRedeemGet.Columns[i].HeaderText + "]";
                        }
                    }
                }
                DataTable objDataTable = BeanHelper.SearchBean.GetData(ViewState["SearchCondition_ProductRedeem"].ToString() + ViewState["OrderBy_ProductRedeem"].ToString(), SelectedColumns);

                PDFWrite objPDFWrite = new PDFWrite();
                objPDFWrite.ExportPDF(objDataTable, (float[])ViewState["PDFColWidth_ProductRedeem"]);
            }
            catch (Exception ex)
            {
                Messagesection.Visible = true;
                Message.Text           = ex.Message;
                LogManager.Log(ex);
            }
        }