private void GetPager() { int id = int.Parse(Request.QueryString["id"].ToString()); //客观题 SqlDataReader dr = KaoJuanService.SelectKaoJuan(id); dr.Read(); lblKaoJuanName.Text = dr["KaoJuanName"].ToString(); Label15.Text = dr["PageFen"].ToString(); SqlDataReader dr2 = ZuJuanService.SelectZuJuan(id); GridView1.DataSource = dr2; GridView1.DataBind(); }
protected void Button1_Click(object sender, EventArgs e) { SqlDataReader sdr = KaoJuanService.SelectKaoJuanTop1(); if (sdr.Read()) { int id = int.Parse(sdr["KaoJuanID"].ToString()); //单选题 foreach (GridViewRow dr in GridView1.Rows) { ZuJuan zj = new ZuJuan(); zj.KaoJuanID = id; zj.TitleID = int.Parse(((Label)dr.FindControl("Label3")).Text); zj.Mark = int.Parse(((Label)dr.FindControl("Label4")).Text); ZuJuanService.Insert(zj); } Page.ClientScript.RegisterStartupScript(this.GetType(), "true", "<script>alert('生成成功!');</script>"); } }