/// <summary> /// 查詢鈕 /// </summary> protected void btnQuery_Click(object sender, EventArgs e) { if (VerifyFormData() == true) { try { //抓取本頁初次登記的時間 string SessionIDName = "CGR081_" + PageTimeStamp.Value; CGRModel.PrintSorterDetl BCO = new CGRModel.PrintSorterDetl(ConntionDB); DataTable Dt = new DataTable(); ParameterList.Clear(); ParameterList.Add(SLP_P_Date.StartDate); ParameterList.Add(SLP_P_Date.EndDate); ParameterList.Add("ALL"); ParameterList.Add(TextBoxRowCountLimit.Text); Dt = BCO.GetSorterBatch(ParameterList); if (Dt.Rows.Count == 0) { ScriptManager.RegisterStartupScript(Page, this.GetType(), "CGR081.aspx", "alert(' 查無資料 ');", true); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "", string.Format("$get('{0}').style.display='none';", btnPrintReport.ClientID), true); GridView1.Visible = false; return; } else { GridView1.Visible = true; Session[SessionIDName] = Dt; //設定分頁大小 //GridView1.PageSize = (TextBoxPagesize.Text == "") ? 10 : (int.Parse(TextBoxPagesize.Text) < 0) ? 10 : int.Parse(TextBoxPagesize.Text); GridView1.PageIndex = 0; GridView1.DataSource = Dt; GridView1.DataBind(); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "", string.Format("$get('{0}').style.display='';", btnPrintReport.ClientID), true); } } catch (Exception ex) { ErrorMsgLabel.Text = ex.Message; } } }