//数据绑定 private void databind() { ChosenSub1.DataKeyNames = new string[] { "SubjectID" }; Fannie.Student getSub = new Fannie.Student(); DataTable dt = getSub.GetChosenSub(id).Tables[0]; if (dt.Rows.Count == 0) { ChosenSub1.DataSource = getSub.GetChosenSub(id); ChosenSub1.DataBind(); Label1.Visible = true; } else { ChosenSub1.DataSource = getSub.GetChosenSub(id); ChosenSub1.DataBind(); Label1.Visible = false; } }
private bool IsChosen() { Fannie.Student stu = new Fannie.Student(); DataTable dt = stu.GetChosenSub(studentid).Tables[0]; if (dt.Rows.Count != 0) { Response.Write("<script> alert('您已经选择了课题,请不要重复选择!')</script>"); return(false); } else { return(true); } }