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

推荐订阅源

量子位
F
Fortinet All Blogs
小众软件
小众软件
人人都是产品经理
人人都是产品经理
The Cloudflare Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Microsoft Azure Blog
Microsoft Azure Blog
J
Java Code Geeks
有赞技术团队
有赞技术团队
D
DataBreaches.Net
Hugging Face - Blog
Hugging Face - Blog
V
Visual Studio Blog
A
About on SuperTechFans
I
InfoQ
The GitHub Blog
The GitHub Blog
Engineering at Meta
Engineering at Meta
雷峰网
雷峰网
H
Hackread – Cybersecurity News, Data Breaches, AI and More
罗磊的独立博客
C
Check Point Blog
大猫的无限游戏
大猫的无限游戏
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
酷 壳 – CoolShell
酷 壳 – CoolShell
MyScale Blog
MyScale Blog

博客园 - Seraph's Zone(WelCome)

ADO 数据类型转换表[转] VC中identifier was truncated to '255' 对FckEditor编辑器在MAXTHON浏览器下选择服务器文件对话框显示不正常的改进 [转]写给C++程序员的C# FAQ [Invalid postback or callback argument]昨晚调试程序时出现的问题,MARK一下 试图运行项目时出错:无法在web服务器上启动项目得解决办法 右键无法查看网页源代码修复方法 javascript去空格函数 asp.net程序编译调试时偶尔出现访问被拒绝的错误 使用VS2003创建WEB程序的时候出现"AutoMation服务器不能创建对象"错误 ASP.NET开发-实用技巧 (“~”的用法、保存滚动条的位置……) Visual Studio.Net 快捷键表 asp.net 获取插入记录的ID url传递中文的解决方案 (转) 解决ASP.NET2.0和1.1在同一台电脑上不能并行的问题(转) 创建插件框架(1) 利用SQLDMO进行数据库备份还原操作 VS2005 常用快捷键 将文件长路径转换为短路径(DOS路径)
如何在ViewState中保存和取出自己定义的类
Seraph's Zone(WelCome) · 2006-10-07 · via 博客园 - Seraph's Zone(WelCome)

举例如下:
比如你的类
[Serializable]   //注意这个
class user
{
public string name;
public int age;
}
第一按钮是保存操作
user user1=new user();
user1.name="zhuye";
user1.age=23;
user user2=new user();
user2.name="chengli";
user2.age=21;
ArrayList al=new ArrayList();
al.Add(user1);
al.Add(user2);
ViewState["data"]=al;
第二个按钮是读取操作
ArrayList al=(ArrayList)ViewState["data"];
foreach(user o in al)
{
Response.Write(o.name+" "+o.age+"<br>");
}

posted on 2006-10-07 19:24  Seraph's Zone(WelCome)  阅读(190)  评论(0)    收藏  举报

刷新页面返回顶部