//��ʾѡ���Ŀ������� protected void ddlCourse_SelectedIndexChanged(object sender, EventArgs e) { FillBlankProblemmr fillblankproblem = new FillBlankProblemmr(); //������������ DataSet ds = fillblankproblem.QueryFillBlankProblem(int.Parse(ddlCourse.SelectedValue));//���ݿ��Կ�Ŀ��ѯ�������Ϣ GridView1.DataSource = ds.Tables[0].DefaultView; //ΪGridView�ؼ�ָ������Դ GridView1.DataBind(); //������ }
//ɾ�������¼� protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) { FillBlankProblemmr fillblankproblem = new FillBlankProblemmr(); //������������ int ID = int.Parse(GridView1.DataKeys[e.RowIndex].Values[0].ToString()); //ȡ��Ҫɾ����¼������ֵ if (fillblankproblem.DeleteByStr(ID)) { Response.Write("<script language=javascript>alert('�ɹ�ɾ�����⣡')</script>"); } else { Response.Write("<script language=javascript>alert('ɾ������ʧ�ܣ�')</script>"); } GridViewBind();//ΪGridView���°����� GridView1.EditIndex = -1; }
protected void GridViewBind() { FillBlankProblemmr fillblankproblem = new FillBlankProblemmr(); //������������ DataSet ds = fillblankproblem.QueryFillBlankProblem(int.Parse(ddlCourse.SelectedValue));//���ݿ��Կ�Ŀ��ѯ�������Ϣ GridView1.DataSource = ds.Tables[0].DefaultView; //ΪGridView�ؼ�ָ������Դ GridView1.DataBind(); //������ }
//ɾ��������¼ protected void ImageButton1_Click(object sender, ImageClickEventArgs e) { FillBlankProblemmr fill = new FillBlankProblemmr();//����FillBlankProblemmr���� foreach (GridViewRow dr in GridView1.Rows)//��GridView�е�ÿһ�н����ж� { if (((CheckBox)dr.FindControl("xuanze")).Checked)//���ѡ���˽���ɾ�� { int ID = int.Parse(((Label)dr.FindControl("Label1")).Text); fill.ID = ID; fill.DeleteByStr(ID); } } }