主頁 > 知識庫 > asp.net Gridview分頁保存選項

asp.net Gridview分頁保存選項

熱門標(biāo)簽:外呼系統(tǒng)代理品牌 手機地圖標(biāo)注如何刪除 寧波自動外呼系統(tǒng)代理 外呼系統(tǒng)費用一年 十堰正規(guī)電銷機器人系統(tǒng) 世紀(jì)佳緣地圖標(biāo)注怎么去掉 怎么給超市做地圖標(biāo)注入駐店 辦理400電話證件 巫師3為什么地圖標(biāo)注的財寶沒有

復(fù)制代碼 代碼如下:

#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


復(fù)制代碼 代碼如下:

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

復(fù)制代碼 代碼如下:

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

您可能感興趣的文章:
  • GridView分頁的實現(xiàn)以及自定義分頁樣式功能實例
  • GridView自定義分頁的四種存儲過程
  • C#自定義DataGridViewColumn顯示TreeView
  • yii2.0之GridView自定義按鈕和鏈接用法
  • GridView自定義刪除操作的具體方法
  • 自定義GridView并且實現(xiàn)拖拽(附源碼)
  • asp.net gridview自定義value值的代碼
  • asp.net gridview分頁:第一頁 下一頁 1 2 3 4 上一頁 最末頁
  • asp.net中的GridView分頁問題
  • Android入門之ActivityGroup+GridView實現(xiàn)Tab分頁標(biāo)簽的方法
  • 基于GridView和ActivityGroup實現(xiàn)的TAB分頁(附源碼)
  • GridView自定義分頁實例詳解(附demo源碼下載)

標(biāo)簽:天門 山西 通遼 嘉興 泰州 牡丹江 景德鎮(zhèn)

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《asp.net Gridview分頁保存選項》,本文關(guān)鍵詞  asp.net,Gridview,分頁,保存,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請?zhí)峁┫嚓P(guān)信息告之我們,我們將及時溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。
  • 相關(guān)文章
  • 下面列出與本文章《asp.net Gridview分頁保存選項》相關(guān)的同類信息!
  • 本頁收集關(guān)于asp.net Gridview分頁保存選項的相關(guān)信息資訊供網(wǎng)民參考!
  • 推薦文章