Exemplo n.º 1
0
    ////绑定课程通知
    //protected void dlstCourseNotify_ItemCommand(object source, DataListCommandEventArgs e)
    //{
    //    DalOperationAboutCourseNotifyInfo dalOperationAboutCourseNotifyInfo = new DalOperationAboutCourseNotifyInfo();
    //    string NotifyId = dlstCourseNotify.DataKeys[e.Item.ItemIndex].ToString();
    //    if (e.CommandName == "delete")
    //    {
    //        dalOperationAboutCourseNotifyInfo.DelCourseNotifyInfoById(int.Parse(NotifyId));
    //        Javascript.JavaScriptLocationHref("CInfoCourseNotify.aspx?courseNo=" + Request["courseNo"], Page);
    //    }
    //    else if (e.CommandName == "editIstop")
    //    {
    //        DalOperationAboutCourses doac = new DalOperationAboutCourses();
    //        string courseNotifyInfoId = dlstCourseNotify.DataKeys[e.Item.ItemIndex].ToString();
    //        CoursesNotifyInfo coursesNotify = doac.FindCourseNotifyById(int.Parse(courseNotifyInfoId));
    //        if (coursesNotify.isTop > 0)
    //            doac.Canceltop(int.Parse(courseNotifyInfoId));
    //        else
    //            doac.Addtop(int.Parse(courseNotifyInfoId));
    //        Javascript.JavaScriptLocationHref("CInfoCourseNotify.aspx?courseNo=" + Request["courseNo"], Page);
    //        //Javascript.JavaScriptLocationHref("CourseInfo.aspx?courseNo=" + Request["courseNo"] + "&fragment=3", Page);
    //    }
    //}
    //删除选定的课程通知
    protected void btnDelete_Click(object sender, EventArgs e)
    {
        DalOperationAboutCourses doac = new DalOperationAboutCourses();
        int courseNotifyInfoId;
        foreach (DataListItem item in this.dlstCourseNotify.Items)
        {

            CheckBox chkItem = (CheckBox)item.FindControl("ChkBox");
            Label lbl = (Label)item.FindControl("lblcourseNotifyInfoId");
            if (chkItem.Checked)
            {
                //被勾选的要删除
                courseNotifyInfoId = int.Parse(lbl.Text);
                doac.DeleteCourseNotifyById(courseNotifyInfoId);
            }
        }
        DataListBindCourseNotify();
    }