private void BindCourseTitle(string year, string semester, string dept) { using (SqlConnection con = new SqlConnection(cs)) { SqlCommand cmd = new SqlCommand("select distinct courseTitle from marksInfo where stdYear='" + year + "' and stdSemester='" + semester + "' and stdDepartment='" + dept + "'", con); con.Open(); SqlDataAdapter sda = new SqlDataAdapter(cmd); DataTable dt = new DataTable(); sda.Fill(dt); if (dt.Rows.Count != 0) { DropDownListForCourseTitle.DataSource = dt; DropDownListForCourseTitle.DataTextField = "courseTitle"; DropDownListForCourseTitle.DataValueField = "courseTitle"; DropDownListForCourseTitle.DataBind(); DropDownListForCourseTitle.Items.Insert(0, new ListItem("Select Course Title...", "0")); } else { DropDownListForCourseTitle.Items.Clear(); DropDownListForCourseTitle.Items.Add("Data Doesn't match"); } } }
protected void updateBtn_Click(object sender, EventArgs e) { int id = Convert.ToInt32(HiddenField1.Value); string stdName = stdNameLabel.Text; string stdId = stdIdLabel.Text; string email = stdEmailLabel.Text; string dept = stdDeptLabel.Text; string year = DropDownListForYear.Text; string semester = DropDownListForSemester.Text; string courseTitle = DropDownListForCourseTitle.SelectedItem.Value; string grade = DropDownListForGrade.SelectedItem.Value; int marks = Convert.ToInt32(marksTextBox.Text.Trim()); marksDAO.updateMarksInfo(new marksDTO(stdName, stdId, email, dept, year, semester, courseTitle, grade, marks), id); updateCourseNO(); updateCredit(); updateTeacher(); DropDownListForYear.SelectedValue = "none"; DropDownListForSemester.SelectedValue = "none"; DropDownListForCourseTitle.ClearSelection(); DropDownListForCourseTitle.Items.FindByValue("0").Selected = true; DropDownListForGrade.SelectedValue = "none"; marksTextBox.Text = string.Empty; MessageBox("Successfully Data Updated !!"); loadDatafromMarksInfo(); }
protected void saveBtn_Click(object sender, EventArgs e) { uploadFile(); DropDownListForYear.SelectedValue = "none"; DropDownListForSemester.SelectedValue = "none"; DropDownListForCourseTitle.ClearSelection(); DropDownListForCourseTitle.Items.FindByValue("0").Selected = true; }
protected void clearBtn_Click(object sender, EventArgs e) { DropDownListForYear.SelectedValue = "none"; DropDownListForSemester.SelectedValue = "none"; DropDownListForCourseTitle.ClearSelection(); DropDownListForCourseTitle.Items.FindByValue("0").Selected = true; DropDownListForGrade.SelectedValue = "none"; marksTextBox.Text = string.Empty; }
protected void deleteBtn_Click(object sender, EventArgs e) { int id = Convert.ToInt32(HiddenField1.Value); marksDAO.deleteMarksInfo(id); DropDownListForYear.SelectedValue = "none"; DropDownListForSemester.SelectedValue = "none"; DropDownListForCourseTitle.ClearSelection(); DropDownListForCourseTitle.Items.FindByValue("0").Selected = true; DropDownListForGrade.SelectedValue = "none"; marksTextBox.Text = string.Empty; MessageBox("Successfully Data Deleted !!"); loadDatafromMarksInfo(); }
private void BindCourseTitle() { using (SqlConnection con = new SqlConnection(cs)) { SqlCommand cmd = new SqlCommand("select distinct courseTitle from marksInfo where teacherEmail='" + Session["TEACHEREMAIL"].ToString() + "'", con); con.Open(); SqlDataAdapter sda = new SqlDataAdapter(cmd); DataTable dt = new DataTable(); sda.Fill(dt); if (dt.Rows.Count != 0) { DropDownListForCourseTitle.DataSource = dt; DropDownListForCourseTitle.DataTextField = "courseTitle"; DropDownListForCourseTitle.DataValueField = "courseTitle"; DropDownListForCourseTitle.DataBind(); DropDownListForCourseTitle.Items.Insert(0, new ListItem("Select Course Title...", "0")); } } }