Ejemplo n.º 1
0
    protected void Btn_Print_Click(object sender, EventArgs e)
    {
        try
        {

            BCO.MaintainTransData bco = new MaintainTransData(ConntionDB);

            DataTable Dt = bco.QueryMainItemByFind(this.getParameterList(), (CheckBoxLikeSearch.Checked) ? true : false);

            if (Dt == null || (Dt != null && Dt.Rows.Count <= 0))
            {
               // ResultMsgLabel.Text = "查無資料";
                ScriptManager.RegisterStartupScript(Page, this.GetType(), "TRN031.aspx", "alert(' 查無資料 ');", true);
            }
            else
            {
                    #region 設定頁面狀態


                    //this.hid_PageStatus.Value = "PRINT";
                    //this.txt_PageStatus.Text = "PRINT";

                    #endregion

                   
                    #region 顯示報表

                    string s_FileName = "";      //設定輸出檔名
                    string s_rptFilePath = "";   //設定報表路徑

                    s_rptFilePath = Server.MapPath("./REPORT/TRN031/TRN031_Report.rpt");
                    s_FileName = HttpUtility.UrlEncode("車輛棧板彙總表.PDF", System.Text.Encoding.UTF8);


                    LoadCrystalReport(s_FileName, s_rptFilePath, Dt, "PDF");
                    #endregion

                  
                }

        }
        catch (Exception ex)
        { this.ErrorMsgLabel.Text = ex.ToString(); }
        finally { }
    }