我动态生成的WebControls.Table对象,每行都添加了TextBox、DropDownList控件,现在想只在页面第一次访问是生成该Table对象,然后将该Table对象序列化,保存成文件!但是Table对象是不能序列化,请问有没有方法使其能够被序列化??
解决方案 »
- csdn 发帖子按钮
- 关于事务问题
- 新手关于JS的一个问题!高手快来帮我一下,十万火急……………………………………
- .net发邮件
- 大家来看看这句英文是叫我干嘛来着???
- 200!!!!!求vb写的webserver接收XML,分析数据后再返回xml的代码
- 新浪微博秀的代码插到ASPX里有时候正常显示,过一会又不正常显示了球大神啊!!!
- 关于JS如何验证TextBox1里面必须为数字,TextBox2必须不为空
- ActiveX中ListView Groups不显示
- 关于 button onlick问题(asp.net & C#) 急!!
- .net 网页调用服务器exe失败
- 大家开发都是用的Visual Studio和SQLserver的哪个版本??
[Serializable]
class Table
{
//...
}
for 循环, 看看
TextBox id="TextBox+"i;
http://hi.baidu.com/freeze9527/blog/item/84f9f2184fa874b14bedbcdd.html
加了[Serializable]也没用,还是会报不能序列化
我用的就是IO流
using(FileStream fs = new FileStream(dataFile, FileMode.OpenOrCreate, FileAccess.Write))
{
BinaryFormatter fomatter = new BinaryFormatter();
fomatter.Serialize(fs, table);
}
using(FileStream fs = new FileStream(dataFile, FileMode.OpenOrCreate, FileAccess.Write))
{
BinaryFormatter fomatter = new BinaryFormatter();
fomatter.Serialize(fs, table);
}
能够放入Session的话应该就可以序列化啊,请高手指教!!