コード例 #1
0
        /// <summary>
        /// 保存成绩
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Button1_Click(object sender, EventArgs e)
        {
            DALstudent_course dal = new DALstudent_course();

            foreach (GridViewRow gvr in GridView1.Rows)
            {
                TextBox tb = (TextBox)gvr.FindControl("fs");
                int     id = int.Parse(GridView1.DataKeys[gvr.RowIndex].Value.ToString());
                student_courseEntity sc = dal.Getstudent_course(id);
                if (sc != null)
                {
                    sc.CourseScore = decimal.Parse(tb.Text);
                }
                dal.Modstudent_course(sc);
            }
        }
コード例 #2
0
        protected void btnOK_Click(object sender, EventArgs e)
        {
            DALstudent_course    dal    = new DALstudent_course();
            student_courseEntity course = new student_courseEntity();

            foreach (GridViewRow gvr in grdCourse.Rows)
            {
                if (gvr.RowType == DataControlRowType.DataRow)
                {
                    int id = int.Parse(grdCourse.DataKeys[gvr.RowIndex].Value.ToString());
                    course = dal.Getstudent_course(id);
                    TextBox tb = (TextBox)gvr.FindControl("txtCourse");
                    course.CourseScore = decimal.Parse(tb.Text.Trim());
                    dal.Modstudent_course(course);
                }
            }
        }