Esempio 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);
        }
Esempio 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);
        }
Esempio n. 3
0
 public void DataBindTeacherTypeList(ListItemCollection itemCollection, string teacherType)
 {
     itemCollection.Clear();
     ListItem[] listItems = new ListItem[]
     {
       new ListItem("所有教师", "0"),
       new ListItem("院内教师/助教", "1"),
       new ListItem("院外教师", "2"),
       new ListItem("院外助教", "3")
     };
     if(teacherType != null && teacherType.Trim().Length != 0)
     foreach(ListItem listItem in listItems)
     {
         if(listItem.Value == teacherType.Trim())
         {
             listItem.Selected = true;
             break;
         }
     }
     itemCollection.AddRange(listItems);
 }
		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");
		}