private void QueryData() { #region try { CRMModel.VDS_CRM21_BCO BCO = new CRMModel.VDS_CRM21_BCO(ConnectionDB); DataTable dt = BCO.QueryDisCRMMainByFindForCrm21(GetQueryParams()); string SessionIDName = string.Format("{0}_{1}", PAGE_DT_01, PageTimeStamp.Value); Session[SessionIDName] = dt; aryParamsPKey.Clear(); LabelQueryRecordCount.Visible = false; if (dt != null && dt.Rows.Count > 0) { gv_Result.PageSize = iCurrentGvPageSize; gv_Result.PageIndex = iCurrentGvPageIndex; gv_Result.DataSource = dt; gv_Result.DataBind(); LabelQueryRecordCount.Text = string.Format(" {0} Rows ", dt.Rows.Count.ToString()); foreach (DataRow dr in dt.Rows) { #region aryParamsPKey.Add(dr["DIS_NO"]); #endregion } //有資料才可執行多筆確認、解除 btn_ConfirmMulti.Visible = true; btn_RemoveMulti.Visible = true; } else { btn_ConfirmMulti.Visible = false; btn_RemoveMulti.Visible = false; gv_Result.DataBind(); ResultMsgLabel.Text = "查無資料"; } Session[string.Format("{0}_{1}", strPreFixed, PageTimeStamp.Value)] = aryParamsPKey; } catch (Exception ex) { gv_Result.DataBind(); ErrorMsgLabel.Text = ex.Message; } finally { UpdatePanel2.Update(); } #endregion }