国产片侵犯亲女视频播放_亚洲精品二区_在线免费国产视频_欧美精品一区二区三区在线_少妇久久久_在线观看av不卡

服務器之家:專注于服務器技術及軟件下載分享
分類導航

PHP教程|ASP.NET教程|Java教程|ASP教程|編程技術|正則表達式|C/C++|IOS|C#|Swift|Android|VB|R語言|JavaScript|易語言|vb.net|

服務器之家 - 編程語言 - ASP.NET教程 - asp.net Gridview分頁保存選項

asp.net Gridview分頁保存選項

2019-11-16 12:19asp.net教程網 ASP.NET教程

這篇文章介紹了asp.net Gridview分頁保存選項,有需要的朋友可以參考一下

代碼如下:


#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");
        }

 

延伸 · 閱讀

精彩推薦
主站蜘蛛池模板: 亚洲一区二区三区免费观看 | 中文字幕 国产 | 欧美三级在线 | 我和我的祖国电影在线观看免费版高清 | 国产精品不卡视频 | 亚洲电影在线观看 | 亚洲成人播放 | 欧美视频一区二区 | 欧美中文字幕 | 日本精品一区二区三区在线观看视频 | av在线一区二区 | 亚洲成av人影片在线观看 | 综合激情网 | 91视频免费看片 | 精品一区二区三区成人精品 | 色黄网站 | 亚洲乱码国产乱码精品精的特点 | 午夜精品福利在线观看 | 黄色国产一级片 | 91成人免费在线观看 | 羞羞视频在线观看 | 隔壁老王国产在线精品 | 日本在线免费观看 | 国产老头老太作爱视频 | 成人网18免费网站 | 91在线视频观看 | 国产精品无码永久免费888 | 成年人免费看 | 欧美setu| 国产精品一区二区久久 | 国产一级一级国产 | 一级a毛片 | 精品成人一区二区 | 欧美日韩成人在线播放 | 亚洲人成在线播放 | 黄色a站 | 中国freesex | 欧洲亚洲精品久久久久 | 激情网站免费 | 成人在线播放 | 亚洲二区在线观看 |