예제 #1
0
        protected void GvExamTypeRowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName.Equals("Insert"))
            {
                var ftrPerSubjectMarks = GvExamType.FooterRow != null?GvExamType.FooterRow.FindControl("ftrPerSubjectMarks") as TextBox:
                                         GvExamType.FindControl("emptyDataTemplatePerSubjectMarks") as TextBox;

                var examName = GvExamType.FooterRow != null?GvExamType.FooterRow.FindControl("ftrExamName") as TextBox : GvExamType.FindControl("emptyDataTemplateExamName") as TextBox;

                var ftrPassingMarksPerSubject = GvExamType.FooterRow != null?GvExamType.FooterRow.FindControl("ftrPassingMarksPerSubject") as TextBox : GvExamType.FindControl("emptyDataTemplatePassingMarksPerSubject") as TextBox;

                if (examName != null && !string.IsNullOrEmpty(examName.Text.Trim()) && ftrPerSubjectMarks != null && !string.IsNullOrEmpty(ftrPerSubjectMarks.Text.Trim()) &&
                    ftrPassingMarksPerSubject != null && !string.IsNullOrEmpty(ftrPassingMarksPerSubject.Text.Trim()))
                {
                    PageDataService.AddExamTypeAdoNet(examName.Text, Convert.ToInt32(ftrPerSubjectMarks.Text), Convert.ToInt32(ftrPassingMarksPerSubject.Text));
                }
                Response.Redirect(Request.RawUrl);
            }
        }