惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

I
Intezer
V
Vulnerabilities – Threatpost
Google Online Security Blog
Google Online Security Blog
T
The Exploit Database - CXSecurity.com
C
CXSECURITY Database RSS Feed - CXSecurity.com
AWS News Blog
AWS News Blog
G
GRAHAM CLULEY
P
Privacy & Cybersecurity Law Blog
www.infosecurity-magazine.com
www.infosecurity-magazine.com
C
Cybersecurity and Infrastructure Security Agency CISA
N
News | PayPal Newsroom
T
Tenable Blog
Spread Privacy
Spread Privacy
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
S
Secure Thoughts
P
Privacy International News Feed
IT之家
IT之家
Project Zero
Project Zero
T
The Blog of Author Tim Ferriss
Engineering at Meta
Engineering at Meta
大猫的无限游戏
大猫的无限游戏
博客园_首页
GbyAI
GbyAI
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
量子位
雷峰网
雷峰网
Apple Machine Learning Research
Apple Machine Learning Research
Hacker News: Ask HN
Hacker News: Ask HN
Google DeepMind News
Google DeepMind News
MongoDB | Blog
MongoDB | Blog
N
Netflix TechBlog - Medium
Martin Fowler
Martin Fowler
NISL@THU
NISL@THU
I
InfoQ
D
DataBreaches.Net
有赞技术团队
有赞技术团队
K
Kaspersky official blog
Security Latest
Security Latest
The Register - Security
The Register - Security
Hugging Face - Blog
Hugging Face - Blog
S
Security @ Cisco Blogs
P
Proofpoint News Feed
M
MIT News - Artificial intelligence
H
Hackread – Cybersecurity News, Data Breaches, AI and More
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
AI
AI
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
P
Proofpoint News Feed
Security Archives - TechRepublic
Security Archives - TechRepublic
N
News and Events Feed by Topic

博客园 - 老头

简易OA漫谈之工作流设计(六,快捷表单和动态表单) 简易OA漫谈之工作流设计(五,直接上级) 简易OA漫谈之工作流设计(四,怎么支持会签) 简易OA漫谈之工作流设计(一个Demo),完成6年前的一个贴子 bom头 ERP产品价格成本计算的几个方法 简易OA漫谈之工作流设计(DB实现) 简易OA漫谈之工作流设计(DB) charindex使用一个异常记录思考 开发人员死得很惨的一个问题 程序员半夜泡奶粉,睡不着了 sql server 2005行列轉換 web效率14條規則(轉) 使用mht格式做多sheet excel報表 SOA、反射+緩存 擴展Membership建立中小型WEB權限框架(一) 一个简单的WEB流程图组件[demo] 常用javascript 表達式驗證[綜合轉載] 数据表的设计原则(轉載)
Gridview小技巧-保存選擇狀態
老头 · 2008-09-19 · via 博客园 - 老头

gridview 缺省的分頁是一次性載入所有數據,對大一點的項目肯定是不行的,所以大家都會用其它的分頁控件一頁一頁載入數據.

做批量操作時通常會有一個"CheckBox"列,但如果翻頁就需要保存選擇的狀態,用viewstate來保存還是比較簡單的.

下面代碼放到分頁改變事件中用來把選擇ID列表保存到viewstate中.

Code

下面的代碼,gridview在邦定數據時根據viewstate決定是否選擇.

Code


    //使用的時候也一樣,從viewstate中讀出ID列表
            List<string> IDList = new List<string>();
            if (ViewState["IDList"]!=null)
                IDList = (List<string>)ViewState["IDList"];