protected void SubmitQuestion_Click(object sender, EventArgs e) { UserBO ob = new UserBO(); clsBLL obj = new clsBLL(); if (QuestionBox.Text == null || QuestionBox.Text == "" || Option1Box.Text == "" || Option1Box.Text == null || Option2Box.Text == "" || Option2Box.Text == null || Option3Box.Text == "" || Option3Box.Text == null || Option4Box.Text == "" || Option4Box.Text == null) { Response.Write("<script>alert('Some values aren missing in the required field');</script>"); Server.Transfer("AdminAddCourseQuestions.aspx"); } ob.coursecode = CourseCodeDropList.Text; ob.qno = obj.QuestionnumberfinderBLL(ob.coursecode) + 1; ob.question = QuestionBox.Text; ob.option1 = Option1Box.Text; ob.option2 = Option2Box.Text; ob.option3 = Option3Box.Text; ob.option4 = Option4Box.Text; ob.questAns = CorrectOptionDropList.Text; int m = obj.InsertQuestionBLL(ob); if (m == 1) { statuslabel.Text = "inserted"; QuestionBox.Text = ""; Option1Box.Text = ""; Option2Box.Text = ""; Option3Box.Text = ""; Option4Box.Text = ""; } else { statuslabel.Text = "can't insert"; } using (SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["userdataConnectionString"].ConnectionString.ToString())) { SqlCommand cmd = new SqlCommand("select * from QuestionBank where (CourseID ='" + CourseCodeDropList.Text + "')", con); con.Open(); QuestionsData.DataSource = cmd.ExecuteReader(); QuestionsData.DataBind(); } }