private void ShowClass() { int Wcid = Int32.Parse(Request.QueryString["Cid"].ToString()); LearnSite.BLL.Works ws = new LearnSite.BLL.Works(); ListItem lm = new ListItem(); lm.Text = "全部"; lm.Value = "-1"; DDLclass.Items.Add(lm); DataTable dt = ws.GetListNoWcheckClass(Wcid); int dcount = dt.Rows.Count; if (dcount > 0) { for (int i = 0; i < dcount; i++) { string dclass = dt.Rows[i][0].ToString(); ListItem lsm = new ListItem(); lsm.Text = dclass; lsm.Value = dclass; DDLclass.Items.Add(lsm); } } dt.Dispose(); DDLclass.SelectedValue = "-1"; }