protected void dropdownRoll_SelectedIndexChanged(object sender, EventArgs e) { try { lblMessege.Text = ""; if (dropdownRoll.SelectedValue != null) { var item = new StudentInfoModel(); string StudentId = (dropdownRoll.SelectedItem.ToString()); var reader = _infoManager.GetStudentName(StudentId); if (reader.HasRows) { while (reader.Read()) { txtName.Text = reader["StudentName"].ToString(); } } StudentInfoModel stock = new StudentInfoModel(); string CourseId = (dropdownRoll.SelectedItem.ToString()); var reader1 = _infoManager.GetCourseId(CourseId); if (reader1.HasRows) { while (reader1.Read()) { var courseNames = reader1["CourseName"].ToString(); if (String.IsNullOrEmpty(courseNames)) { txtCourse.Text = 0.ToString(); return; } txtCourse.Text = courseNames; } } string DepartmentId = (dropdownRoll.SelectedItem.ToString()); var reader12 = _infoManager.GetDepartmentId(DepartmentId); if (reader12.HasRows) { while (reader12.Read()) { var departnents = reader12["Department"].ToString(); if (String.IsNullOrEmpty(departnents)) { txtdepartment.Text = 0.ToString(); return; } txtdepartment.Text = departnents; } } return; } txtName.Text = 0.ToString(); } catch (Exception exception) { lblMessege.Text = exception.Message; } }