Tester for System.Web.UI.WebControls.ListItem
예제 #1
0
        /// <summary>
        /// For internal use only.
        /// </summary>
        protected internal void ChangeItemSelectState(ListItemTester item, bool selected)
        {
            if (Disabled)
            {
                throw new ControlDisabledException(this);
            }

            string name = Attribute("name");

            if (!Multiple)
            {
                Form.Variables.RemoveAll(name);
            }
            if (selected)
            {
                Form.Variables.Add(name, item.Value);
            }
            else
            {
                WebAssert.True(Multiple, "Can't deselect items unless list box is multi-select");
                Form.Variables.Remove(name, item.Value);
            }
            Form.OptionalPostBack(Tag.OptionalAttribute("onchange"));
        }
예제 #2
0
        /// <summary>
        /// For internal use only.
        /// </summary>
        protected internal void ChangeItemSelectState(ListItemTester item, bool selected)
        {
            if (Disabled) throw new ControlDisabledException(this);

            string name = Attribute("name");
            if (!Multiple) Form.Variables.RemoveAll(name);
            if (selected)
            {
                Form.Variables.Add(name, item.Value);
            }
            else
            {
                WebAssert.True(Multiple, "Can't deselect items unless list box is multi-select");
                Form.Variables.Remove(name, item.Value);
            }
            Form.OptionalPostBack(Tag.OptionalAttribute("onchange"));
        }
예제 #3
0
 /// <summary>
 /// Determines whether the collection contains the specified item.
 /// </summary>
 /// <param name="item">A System.Web.UI.WebControls.ListItem to search for in the collection.</param>
 /// <returns>true if the collection contains the specified item; otherwise, false.</returns>
 public bool Contains(ListItemTester item)
 {
     return InnerList.Contains(item);
 }
예제 #4
0
 /// <summary>
 /// Determines whether the collection contains the specified item.
 /// </summary>
 /// <param name="item">A System.Web.UI.WebControls.ListItem to search for in the collection.</param>
 /// <returns>true if the collection contains the specified item; otherwise, false.</returns>
 public bool Contains(ListItemTester item)
 {
     return(InnerList.Contains(item));
 }