public override bool Equals(object obj) { if (obj == null || GetType() != obj.GetType()) { return(false); } SelectedListItem tmp = (SelectedListItem)obj; return(this.Value == tmp.Value || this.Index == tmp.Index); }
protected override bool LoadPostData(string postDataKey, NameValueCollection postCollection) { string text = postCollection[string.Concat(this.UniqueName, "_text")]; string values = postCollection[this.UniqueName]; string indexes = postCollection[string.Concat(this.UniqueName, "_indexes")]; if (values == null) { return(false); } bool fireEvent = false; if (string.IsNullOrEmpty(values)) { fireEvent = this.SelectedItems.Count > 0; this.SelectedItems.Clear(); return(fireEvent); } string[] arrValues = values.Split(new[] { this.Delimiter }, StringSplitOptions.RemoveEmptyEntries); string[] arrIndexes = indexes.Split(new[] { this.Delimiter }, StringSplitOptions.RemoveEmptyEntries); string[] arrText = new string[0]; if (!string.IsNullOrEmpty(text)) { arrText = text.Split(new[] { this.Delimiter }, StringSplitOptions.RemoveEmptyEntries); } SelectedListItemCollection temp = new SelectedListItemCollection(); for (int i = 0; i < arrValues.Length; i++) { string value = arrValues[i]; string index = arrIndexes[i]; string _text = arrText.Length > 0 ? arrText[i] : ""; SelectedListItem item = new SelectedListItem(_text, value, int.Parse(index)); temp.Add(item); if (!this.SelectedItems.Contains(item)) { fireEvent = true; } } this.SelectedItems.Clear(); this.SelectedItems.AddRange(temp); return(fireEvent); }