protected void Button1_Click(object sender, EventArgs e) { string msg = null; for (int i = 0; i < GridView1.Rows.Count; i++) { CheckBox cb = GridView1.Rows[i].Cells[8].FindControl("cbb") as CheckBox; Label lbl = GridView1.Rows[i].Cells[0].FindControl("ldl1") as Label; Label Tlbl = GridView1.Rows[i].Cells[9].FindControl("Label1") as Label; if (cb.Checked) { ITCastOCSS.BLL.Elective lel = new ITCastOCSS.BLL.Elective(); //lel.Xuanke(,3); if (lel.Xuanke(stu.SID, Convert.ToInt32(lbl.Text), Convert.ToInt32(Tlbl.Text))) { msg = "选择成功"; GridView1.DataBind(); } else { msg = "选择失败"; } } } Label2.Text = msg; }
protected void Button1_Click(object sender, EventArgs e) { for (int i = 0; i < GridView1.Rows.Count; i++) { Label lbl = GridView1.Rows[i].Cells[0].FindControl("ldlscore") as Label; TextBox txt = GridView1.Rows[i].Cells[4].FindControl("TextBox1") as TextBox; if (txt.Text.Trim() != "") { int eid = Convert.ToInt32(lbl.Text); double score = Convert.ToDouble(txt.Text); ITCastOCSS.BLL.Elective ele = new ITCastOCSS.BLL.Elective(); ele.input(eid, score); } } Label1.Text = "更新成功"; GridView1.DataBind(); }