protected void btnShowSubjects_Onclick(object sender, EventArgs e) { try { SqlDataAdapter ad = new SqlDataAdapter("select IMID,SID,RollNo from ExamForm where SubID='" + ddlsubcode.SelectedValue.ToString() + "' and RollStatus='AdmitCardGenerated' and ExamSession='" + lblSeasonHidden.Text.ToString() + "' and MarkStatus='NotSubmitted'", con); DataSet ds = new DataSet(); ad.Fill(ds); GridMarks.DataSource = ds; GridMarks.DataBind(); } catch (SqlException ex) { lblExceptionShowSubject.Text = ex.ToString(); } if (GridMarks.Rows.Count > 0) { GridMarks.Focus(); } else { btnShowEnrolment.Focus(); } }
protected void ddlSubCode_SelectedIndexChanged(object sender, EventArgs e) { con.Close(); con.Open(); details(); try { GridMarks.DataSource = grid(); GridMarks.DataBind(); if (GridMarks.Rows.Count == 0) { btnSave.Enabled = false; } else { btnSave.Enabled = true; } GridMarks.Focus(); con.Close(); con.Dispose(); } catch (SqlException ex) { //lblExceptionShowSubject.Text = ex.ToString(); } }