Exemplo n.º 1
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     string strErr = "";
     if (TeacherList.SelectedValue == "0")
     {
         strErr += "请选择教师!\\n";
     }
     if (CourseList.SelectedValue == "0")
     {
         strErr += "请选择课程!\\n";
     }
     if (strErr != "")
     {
         Maticsoft.Common.MessageBox.Show(this, strErr);
     }
     int id = int.Parse(Request["id"]);
     teach = bll.GetModel(id);
     teach.TeacherId = int.Parse(TeacherList.SelectedValue);
     teach.CourseId = int.Parse(CourseList.SelectedValue);
     if (bll.Update(teach))
     {
         Maticsoft.Common.MessageBox.ShowAndRedirect(this, "修改成功!", "TeachList.aspx");
     }
     else
     {
         Maticsoft.Common.MessageBox.Show(this, "修改失败!");
     }
 }
Exemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                int id = int.Parse(Request["id"]);
                teach = bll.GetModel(id);

                LoadTeacher();
                LoadCourse();

                TeacherList.Items.FindByValue(teach.TeacherId.ToString()).Selected = true;
                CourseList.Items.FindByValue(teach.CourseId.ToString()).Selected = true;
            }
        }