Пример #1
0
        public void DateDropDownListDemo()
        {
            // Manage DateDropDownList custom control from the code behind
            DateDropDownList ddl = new DateDropDownList();

            ddl.DisplayDateFormat = "MM/dd/yyyy";

            // Add date/time items to the list
            ddl.AddDateItem(new DateTime(2007, 7, 5));
            ddl.AddDateItem(new DateTime(2007, 7, 5, 9, 0, 0));
            ddl.AddDateItems(new DateTime[] { DateTime.Today, DateTime.Now, DateTime.Now.AddDays(2) });
            ddl.AddDateItems(new DateTime(2007, 7, 6), new DateTime(2007, 7, 12));

            // Remove date/time items from the list
            // The delCount will be 1 after the next operation
            int delCount = ddl.RemoveDateItem(new DateTime(2007, 7, 5));

            // The delCount will be 0 after the next operation
            delCount = ddl.RemoveDateItem(new DateTime(2007, 7, 5));
            // Remove several items
            delCount = ddl.RemoveDateItems(new DateTime[] { DateTime.Today, DateTime.Now });
            delCount = ddl.RemoveDateItems(new DateTime(2007, 7, 6), new DateTime(2007, 7, 12));

            // Get the selected item
            ddl.Items[0].Selected = true;
            DateTime selItem = ddl.SelectedDate;
        }
Пример #2
0
 public void TearDown()
 {
     ddl = null;
 }
Пример #3
0
 public void SetUp()
 {
     ddl = new DateDropDownList();
     ddl.DisplayDateFormat = DisplayDateFormat1;
 }