public class UserFieldControl : Control, INamingContainer
{
。public string FieldName
{
get
{
object obj = this.ViewState["FieldName"];
HttpContext.Current.Response.Write(obj == null);
HttpContext.Current.Response.Write("<br />");
if (obj != null)
{
return (string)obj;
}
return string.Empty;
}
set
{
this.ViewState["FieldName"] = value;
HttpContext.Current.Response.Write(this.ViewState["FieldName"] );
HttpContext.Current.Response.Write("<br />");
}
}public ArrayList FieldPropertys
{
get
{
object obj = this.ViewState["FieldPropertys"];
HttpContext.Current.Response.Write(obj == null);
HttpContext.Current.Response.Write("<br />");
if (obj != null)
{
return (ArrayList)obj;
}
else
{
ArrayList property = new ArrayList();
for (int i = 0; i < 10; i++)
{
property.Add(string.Empty);
}
return property;
}
}
set
{
this.ViewState["FieldPropertys"] = value;
HttpContext.Current.Response.Write(this.ViewState["FieldPropertys"] );
HttpContext.Current.Response.Write("<br />");
}
}}。。
在页面中设置好控件属性后输出:test //fieldName的值
True // fieldname中判断 obj == null
False // FieldPropertys 中判断 obj == null
System.Collections.ArrayList //FieldPropertys 的值为什么FieldPropertys 会先get再set??其他类型的属性都是先 set 再 get
老取不到FieldPropertys 的值
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货