protected void Page_Load(object sender, EventArgs e) { String[] str = (String[])Session["user"]; ID = (String)str.GetValue(0); int id = Int32.Parse(ID); List<String> time = new List<String>(); DateTime t = DateTime.Today; for (int i = 0; i < 48; i++) { String st = t.ToShortTimeString(); time.Add(st); DropDownList1.Items.Add(st); t = t.AddMinutes(30); } // DropDownList1.DataSource = time; //DropDownList1.DataBind(); //Label1.Text = t.ToShortTimeString(); if (!Page.IsPostBack) { MyService.UserWebService uws = new UserWebService(); uws.Credentials = System.Net.CredentialCache.DefaultCredentials; String[] dname = uws.getDepartment(id); foreach (String name in dname) { DropDownList3.Items.Add(new ListItem(name, name)); } } }