- 爱易网页
-
ASP.NET教程
- System.StackOverflowException 小弟我觉得没有什么错误呀,请帮小弟我看看出在什么地方错了
日期:2014-05-19 浏览次数:20426 次
System.StackOverflowException 我觉得没有什么异常呀,请帮我看看出在什么地方错了。
public enum TextReadOnly
{
Yedit=0,//可录入
Nedit=1
}
public enum DataValidate
{
Yvalidate = 0,//可验证
Nvalidate = 1
}
public partial class pub_ddl02 : System.Web.UI.UserControl
{
public virtual TextReadOnly TextEdit
{
get
{
object textedit = ViewState[ "TextEdit "];
if (textedit== null)
return TextReadOnly.Yedit;
else
return (TextReadOnly)TextEdit;
}
set
{
ViewState[ "TextEdit "] = value;
}
}
public virtual DataValidate Validate
{
get
{
object validate = ViewState[ "Validate "];
if (validate == null)
return DataValidate.Yvalidate;
else
return (DataValidate)validate;
}
set
{
ViewState[ "Validate "] = value;
}
}
}
------解决方案--------------------
这种错误就是产生了递归调用
这个属性改成
public virtual TextReadOnly TextEdit
{
get
{
object textedit = ViewState[ "TextEdit "];
if (textedit == null)
return TextReadOnly.Yedit;