Ejemplo n.º 1
0
        protected void llenaCombo()
        {
            System.Web.UI.WebControls.ListItemCollection cboitems = new System.Web.UI.WebControls.ListItemCollection();
            System.Web.UI.WebControls.ListItem[]         li       = new System.Web.UI.WebControls.ListItem[cmbRol.Items.Count];
            cmbRol.Items.CopyTo(li, 0);
            cboitems.AddRange(li);
            cboitems.RemoveAt(1);

            creaCombo(cboitems, "cboRol", 0, out HTMLCboRol);
        }
Ejemplo n.º 2
0
        protected void llenaCombo()
        {
            System.Web.UI.WebControls.ListItemCollection cboitems = new System.Web.UI.WebControls.ListItemCollection();
            System.Web.UI.WebControls.ListItem[]         li       = new System.Web.UI.WebControls.ListItem[cmbCalidad.Items.Count];
            cmbCalidad.Items.CopyTo(li, 0);
            cboitems.AddRange(li);
            cboitems.RemoveAt(1);

            creaCombo(cboitems, "CboCalidad1", 0, out HTMLCboCalidad1);
            creaCombo(cboitems, "CboCalidad2", 0, out HTMLCboCalidad2);
            creaCombo(cboitems, "CboCalidad3", 0, out HTMLCboCalidad3);
            creaCombo(cboitems, "CboCalidad4", 0, out HTMLCboCalidad4);
        }
		public void Methods ()
		{
			ListItemCollection	c;
			ListItem		i;
			ListItem		i2;

			c = new ListItemCollection();
			Assert.AreEqual (0, c.Count, "T1");

			i = new ListItem("Item 1", "10");
			c.Add(i);
			Assert.AreEqual (1, c.Count, "T2");

			i = new ListItem("This is item 2", "20");
			c.Add(i);
			Assert.AreEqual (2, c.Count, "T3");

			Assert.AreEqual (null, c.FindByText(" is "), "T4");
			Assert.AreEqual (i.Text, c.FindByText("This is item 2").Text, "T5");
			Assert.AreSame (i, c.FindByText("This is item 2"), "T6");
			Assert.AreEqual (1, c.IndexOf(c.FindByText("This is item 2")), "T7");
			Assert.AreEqual (1, c.IndexOf(c.FindByValue("20")), "T8");

			i = new ListItem("Item 3", "30");
			Assert.IsFalse(c.Contains(i), "T9");
			c.Add(i);
			Assert.IsTrue(c.Contains(i), "T10");

			i = new ListItem("Forth", "40");
			i2 = new ListItem("Fifth", "50");
			c.AddRange(new ListItem[] {i, i2});
			Assert.AreEqual (5, c.Count, "T11");

			c.RemoveAt(1);
			Assert.AreEqual (4, c.Count, "T12");
			Assert.AreEqual (null, c.FindByText("This is item 2"), "T13");

			c.Clear();
			Assert.AreEqual (0, c.Count, "T13");
		}
		public void RemoveInvalidTest () 
		{
			ListItemCollection	c;
			ListItem		i;
			ListItem		i2;

			c = new ListItemCollection();
			i = new ListItem("Item 1", "1");
			i2 = new ListItem("Item 2", "2");

			c.Add(i);
			c.Add(i2);

			c.RemoveAt(20);
		}