private void Readwork() { int Wcid = Int32.Parse(Request.QueryString["Cid"].ToString()); int Wclass = Int32.Parse(DDLclass.SelectedValue); LearnSite.BLL.Works ws = new LearnSite.BLL.Works(); DDLstore.DataSource = ws.GetListNoWcheckWork(Wcid, Wclass); DDLstore.DataTextField = "Sname"; DDLstore.DataValueField = "Wurl"; DDLstore.DataBind(); int curindex = Int32.Parse(lbcurindex.Text); if (DDLstore.Items.Count > 0) { int allindex = DDLstore.Items.Count - 1; if (curindex == allindex) { lbcurindex.Text = "0"; } if (curindex < allindex) { DDLstore.SelectedIndex = curindex; } } }