[Serializable]DataSetBase:DataSet写入ViewState后不能读出来,为什么呀?请教思归孟子等高手
阿拉丁 2003-10-20 07:22:06 定义:
[Serializable]
public class DataSetBase : DataSet
{...}
应用
DataSetBase myDS = new DataSetBase();
//myDS赋值
ViewState["myds"] = myDS ; //没问题
myDS = (DataSetBase)ViewState["myds"]; //这句话出错
如果不加[Serializable],错误为:
The type 'Ammic.DataSetBase' must be marked as Serializable or have a TypeConverter other than ReferenceConverter to be put in viewstate.
如果加上[Serializable],错误为:
The View State is invalid for this page and might be corrupted.
如果将ViewState改成Session,,则运行正常没有错误。
请问:DataSet继承后能否继续使用ViewState?什么原因?怎么改?