Example #1
0
    /// <summary>
    /// 繫結資料到控制項
    /// </summary>
    /// <param name="vdb"></param>
    private void QueryData()
    {
        #region

        string SessionIDName = string.Format("{0}_{1}", PAGE_DT_01, PageTimeStamp.Value);
        MKTModel.VDS_MKT22_BCO BCO = new MKTModel.VDS_MKT22_BCO(ConnectionDB);

        DataTable dt = null;

        dt = BCO.QUERY_UN_TAG_PMA(GetQueryParams());

        Session[SessionIDName] = dt;
        Int32 iRowCount = 0;
        aryParamsPKey.Clear();


        GridView1.DataSource = dt;
        GridView1.PageSize = (TextBoxPagesize.Text == "") ? 10 : (int.Parse(TextBoxPagesize.Text) <= 0) ? 10 : int.Parse(TextBoxPagesize.Text);
        GridView1.PageIndex = 0;
        GridView1.DataBind();

        if (dt != null && dt.Rows.Count > 0)
        {
            iRowCount = dt.Rows.Count;

            foreach (DataRow dr in dt.Rows)
            {
                #region
                aryParamsPKey.Add(dr["ID"].ToString());
                #endregion
            }
        }
        else
        {
            ErrorMsgLabel.Text = "查無資料";
        }


        Session[string.Format("{0}_{1}", strPreFixed, PageTimeStamp.Value)] = aryParamsPKey;

        LabelQueryRecordCount.Text = string.Format(" {0} Rows ", iRowCount);

        #endregion
    }