国产99久久精品_欧美日本韩国一区二区_激情小说综合网_欧美一级二级视频_午夜av电影_日本久久精品视频

最新文章專題視頻專題問答1問答10問答100問答1000問答2000關鍵字專題1關鍵字專題50關鍵字專題500關鍵字專題1500TAG最新視頻文章推薦1 推薦3 推薦5 推薦7 推薦9 推薦11 推薦13 推薦15 推薦17 推薦19 推薦21 推薦23 推薦25 推薦27 推薦29 推薦31 推薦33 推薦35 推薦37視頻文章20視頻文章30視頻文章40視頻文章50視頻文章60 視頻文章70視頻文章80視頻文章90視頻文章100視頻文章120視頻文章140 視頻2關鍵字專題關鍵字專題tag2tag3文章專題文章專題2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章專題3
問答文章1 問答文章501 問答文章1001 問答文章1501 問答文章2001 問答文章2501 問答文章3001 問答文章3501 問答文章4001 問答文章4501 問答文章5001 問答文章5501 問答文章6001 問答文章6501 問答文章7001 問答文章7501 問答文章8001 問答文章8501 問答文章9001 問答文章9501
當前位置: 首頁 - 科技 - 知識百科 - 正文

asp.net Gridview分頁保存選項

來源:懂視網 責編:小采 時間:2020-11-27 22:40:36
文檔

asp.net Gridview分頁保存選項

asp.net Gridview分頁保存選項: 代碼如下:#region //'Revision: 1.00 Created Date: 2013/08/02 Created ID: Una [#1300071]增加多選框 /// <summary> /// Session獲取多選框值 /// </summary> private void RememberOldVal
推薦度:
導讀asp.net Gridview分頁保存選項: 代碼如下:#region //'Revision: 1.00 Created Date: 2013/08/02 Created ID: Una [#1300071]增加多選框 /// <summary> /// Session獲取多選框值 /// </summary> private void RememberOldVal

代碼如下:
#region //'Revision: 1.00 Created Date: 2013/08/02 Created ID: Una [#1300071]增加多選框
        /// <summary>
        /// Session獲取多選框值
        /// </summary>
        private void RememberOldValues()
        {
            ArrayList categoryIDList = new ArrayList();
            string index = "";
            foreach (GridViewRow row in gridView.Rows)
            {
                index = (string)gridView.DataKeys[row.RowIndex].Value;
                bool result = ((CheckBox)row.FindControl("DeleteThis")).Checked;

                // Check in the Session
                if (Session["id"] != null)
                    categoryIDList = (ArrayList)Session["id"];
                if (result)
                {
                    if (!categoryIDList.Contains(index))
                        categoryIDList.Add(index);
                }
                else
                    categoryIDList.Remove(index);
            }
            if (categoryIDList != null && categoryIDList.Count > 0)
                Session["id"] = categoryIDList;
        }

        /// <summary>
        /// Session分頁時之前多選框為true
        /// </summary>
        private void RePopulateValues()
        {
            ArrayList categoryIDList = (ArrayList)Session["id"];
            if (categoryIDList != null && categoryIDList.Count > 0)
            {
                foreach (GridViewRow row in gridView.Rows)
                {
                    string index = (string)gridView.DataKeys[row.RowIndex].Value;
                    if (categoryIDList.Contains(index))
                    {
                        CheckBox myCheckBox = (CheckBox)row.FindControl("DeleteThis");
                        myCheckBox.Checked = true;
                    }
                }
            }
        }
        #endregion

代碼如下:
protected void gridView_PageIndexChanging(object sender, GridViewPageEventArgs e)
        {
            RememberOldValues();
            gridView.PageIndex = e.NewPageIndex;
            BindData();
            RePopulateValues();
        }

代碼如下:
protected void btnSelect_Click(object sender, EventArgs e)
        {
            string items = "";
            ArrayList categoryIDList = new ArrayList();
            string index ="";
            foreach (GridViewRow row in gridView.Rows)
            {
                index = (string)gridView.DataKeys[row.RowIndex].Value;
                bool result = ((CheckBox)row.FindControl("DeleteThis")).Checked;

                // Check in the Session
                if (Session["id"] != null)
                    categoryIDList = (ArrayList)Session["id"];
                if (result)
                {
                    if (!categoryIDList.Contains(index))
                        categoryIDList.Add(index);
                }
                else
                    categoryIDList.Remove(index);
            }
            if (categoryIDList != null && categoryIDList.Count > 0)
                for (int i = 0; i < categoryIDList.Count; i++)
                {
                    items += categoryIDList[i] + ",";
                }
            items = items.Substring(0, items.Length - 1);
            ScriptManager.RegisterStartupScript(this, this.GetType(), "", "check('" + items + "');", true);
            Session.Remove("id");
        }

聲明:本網頁內容旨在傳播知識,若有侵權等問題請及時與本網聯系,我們將在第一時間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com

文檔

asp.net Gridview分頁保存選項

asp.net Gridview分頁保存選項: 代碼如下:#region //'Revision: 1.00 Created Date: 2013/08/02 Created ID: Una [#1300071]增加多選框 /// <summary> /// Session獲取多選框值 /// </summary> private void RememberOldVal
推薦度:
標簽: 保存 net 分頁
  • 熱門焦點

最新推薦

猜你喜歡

熱門推薦

專題
Top
主站蜘蛛池模板: 国产情侣91 | 国产成人精品久久一区二区小说 | 欧美亚洲国产精品久久久 | 98成人网 | 国产日本在线 | 亚洲日韩图片专区第1页 | 亚洲综合久久久 | 久久99精品一久久久久久 | 亚洲国内自拍 | 亚州色图欧美色图 | 在线免费国产 | 国产阿v| 亚洲一区二区三区在线 | 欧美亚洲韩国 | 亚洲欧洲视频在线 | 在线观看欧美国产 | 欧美日韩亚洲一区二区 | 曰韩在线 | 欧美亚洲国产精品久久久 | 国产香蕉视频 | 国产欧美日韩在线播放 | 亚洲图片国产日韩欧美 | 日韩欧美一二三区 | 国产精品欧美韩国日本久久 | 色接久久| 欧美国产激情二区三区 | 国产欧美精品 | 亚洲三级在线播放 | 国产在线观看一区二区三区 | 欧美日韩极品 | 五月天婷婷基地 | 欧美伦禁片在线播放 | 黄网站色视频免费观看45分钟 | 亚洲欧美日韩中另类在线 | 国产成人拍精品视频网 | 日韩中文在线视频 | 欧美日韩一二三区 | 欧美激情伊人 | 欧美不卡在线视频 | 亚洲一区日韩 | 欧美成人国产 |