为什么强类型的表对象不能放到ViewState而普通的表对象却可以放进去?
解决方案 »
- gridview和checkbox的问题
- c# 截取字符串 问题
- 求高手帮忙!利用存储过程添加商品问题
- 制作导航菜单
- 如何程序来创建Web Applcation?
- 求好心人,这个怎么实现呢,挺简单的
- 如何在后端获得控件类型,并清空值...(在线等....谢谢:>)
- 有没有办法让页面自动跳转回上一级页面(有两个页面可以同时跳转到这个页面),其实就是后退的效果!
- 如何将数据回传给指定web窗体?
- System.UnauthorizedAccessException: 检索 COM 类工厂中 CLSID 为 {00024500-0000-0000-C000
- 同志们帮我看看这删除语句哪错了!急 啊,多谢!
- 怎样取treeview中值
这个就要用一个特殊的构造函数来实现
看看这个类:(转自八卦小子在 http://community.csdn.net/Expert/topic/3328/3328701.xml?temp=.9649469 的回帖)
[Serializable]
public class MyObject : ISerializable
{
public int n1;
public int n2;
public String str; public MyObject()
{
} protected MyObject(SerializationInfo info, StreamingContext context)
{
n1 = info.GetInt32("i");
n2 = info.GetInt32("j");
str = info.GetString("k");
} public virtual void GetObjectData(SerializationInfo info,
StreamingContext context)
{
info.AddValue("i", n1);
info.AddValue("j", n2);
info.AddValue("k", str);
}
}