private void Page_Load(object sender, System.EventArgs e)
{
if(!this.IsPostBack)
{
seDS=subject.getSubject();
DropDownList1.DataSource=seDS;
DropDownList1.DataTextField="Subject_Name";
DropDownList1.DataValueField="Subject_Id";
this.DataBind();
int Question_Subject=Convert.ToInt32(DropDownList1.Items[0].Value);
mainDS=question.getQuestionBySubject(Question_Subject);
DataGrid1.DataSource=mainDS.Tables[0].DefaultView;
DataGrid1.DataBind();
}
} private void DropDownList1_SelectedIndexChanged(object sender, System.EventArgs e)
{
seDS=subject.getSubject();
DropDownList1.DataSource=seDS;
DropDownList1.DataTextField="Subject_Name";
DropDownList1.DataValueField="Subject_Id";
this.DataBind();
int Question_Subject=Convert.ToInt32(DropDownList1.Items[DropDownList1.SelectedIndex].Value); mainDS=question.getQuestionBySubject(Question_Subject);
DataGrid1.DataSource=mainDS.Tables[0].DefaultView;
DataGrid1.DataBind();
}
}
页面展开出现DropDownList默认选择的考试题目
我想根据DropDownList的选择的科目取得考试题目
但是在选择后没能改变 且还是原来信息
{
if(!this.IsPostBack)
{
seDS=subject.getSubject();
DropDownList1.DataSource=seDS;
DropDownList1.DataTextField="Subject_Name";
DropDownList1.DataValueField="Subject_Id";
this.DataBind();
int Question_Subject=Convert.ToInt32(DropDownList1.Items[0].Value);
mainDS=question.getQuestionBySubject(Question_Subject);
DataGrid1.DataSource=mainDS.Tables[0].DefaultView;
DataGrid1.DataBind();
}
} private void DropDownList1_SelectedIndexChanged(object sender, System.EventArgs e)
{
seDS=subject.getSubject();
DropDownList1.DataSource=seDS;
DropDownList1.DataTextField="Subject_Name";
DropDownList1.DataValueField="Subject_Id";
this.DataBind();
int Question_Subject=Convert.ToInt32(DropDownList1.Items[DropDownList1.SelectedIndex].Value); mainDS=question.getQuestionBySubject(Question_Subject);
DataGrid1.DataSource=mainDS.Tables[0].DefaultView;
DataGrid1.DataBind();
}
}
页面展开出现DropDownList默认选择的考试题目
我想根据DropDownList的选择的科目取得考试题目
但是在选择后没能改变 且还是原来信息
DropDownList1.DataSource=seDS;
DropDownList1.DataTextField="Subject_Name";
DropDownList1.DataValueField="Subject_Id";
this.DataBind();