protected void registerStudentsList_ItemDeleting(object sender, ListViewDeleteEventArgs e) { string studentID = ""; HiddenField studentIDField = (registerStudentsList.Items[e.ItemIndex].FindControl("studentID")) as HiddenField; if (studentIDField != null) { studentID = studentIDField.Value.ToString(); } dbops.deleteStudentDetails(studentID); registerStudentsList.EditIndex = -1; registerStudentsList.DataSource = dbops.getStudentsList(ddlClasses.SelectedValue, ddlSection.SelectedValue); registerStudentsList.DataBind(); }