3 * Namespace : System.Web.UI.MobileControls
4 * Class : ObjectListCommandEventHandler
5 * Author : Gaurav Vaish
7 * Copyright : 2003 with Gaurav Vaish, and with
12 using System.Web.Mobile;
14 namespace System.Web.UI.MobileControls
16 public class ObjectListItem : MobileListItem
18 private ObjectList owner;
19 private string[] fields;
20 private bool dirty = false;
22 internal ObjectListItem(ObjectList owner, object dataItem)
23 : base(dataItem, null, null)
26 this.fields = new string[owner.AllFields.Count];
29 internal ObjectListItem(ObjectList owner)
34 public string this[int key]
38 if(fields != null && fields.Length >= key - 1
39 && fields[key] != null)
45 if(fields != null && fields.Length >= key - 1)
47 if(IsTrackingViewState)
64 public string this[string fieldName]
68 return this[IndexOf(fieldName)];
72 this[IndexOf(fieldName)] = value;
76 [MonoTODO("Exception_Details_Not_Exact")]
77 private int IndexOf(string fieldName)
79 int index = owner.AllFields.IndexOf(fieldName);
82 throw new ArgumentException("ObjectList_FieldNotFound");
87 public override bool Equals(object obj)
90 if(obj is ObjectListItem)
92 ObjectListItem oli = (ObjectListItem) obj;
93 if(oli.fields != null && this.fields != null)
95 if(this.fields.Length == oli.fields.Length)
98 for(i = 0; i < fields.Length; i++)
100 if(fields[i] != oli.fields[i])
103 if(i == fields.Length)
107 retVal &= (Value == oli.Value);
108 retVal &= (Text == oli.Text);
113 public override int GetHashCode()
115 return (fields == null ? Value.GetHashCode() :
116 fields[0].GetHashCode());