protected void btnSubmit_Click(object sender, EventArgs e) { var connectionString = ConfigurationManager.ConnectionStrings["connection"].ConnectionString; _studentService = new Student(connectionString); _studentEnrollmentNumber = Convert.ToInt32(txtStudentId.Text); if (_studentService.SearchStudent(_studentEnrollmentNumber)) { Response.Redirect(String.Format("UpdateStudent.aspx?RollNo={0}",_studentEnrollmentNumber)); } else Response.Redirect("HomePage.aspx"); }