标签:
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
GradeBind();
}
}
//绑定年级
private void GradeBind()
{
Rubric.BLL.Grades myBll = new Rubric.BLL.Grades();
ddlGrade.DataSource = myBll.GetAllList();
ddlGrade.DataTextField = "Name";
ddlGrade.DataValueField = "GradeId";
ddlGrade.DataBind();
}
//ddlGrade的selectindexchanged事件
protected void ddlGrade_SelectedIndexChanged(object sender, EventArgs e)
{
string _gradeId = ddlGrade.SelectedValue.ToString();
string _str = "GradeId=‘" + _gradeId + "‘";
Rubric.BLL.Courses myBll = new Rubric.BLL.Courses();
DataSet ds = myBll.GetList(_str);
ddlCourse.DataSource = ds;
ddlCourse.DataTextField = "Name";
ddlCourse.DataValueField = "CourseId";
ddlCourse.DataBind();
}
标签:
原文地址:http://www.cnblogs.com/wanshutao/p/4322885.html