protected void gviewReferences_SelectedIndexChanged(object sender, EventArgs e)
{
GridView referenceGrid = sender as GridView;
//Grab the reference from the dataKey ID
int currentReferenceID = (int)referenceGrid.SelectedDataKey["ID"];
Reference currentReference = ReferenceBLL.GetByID(currentReferenceID);
//Now fill in the form fields with the current reference
txtReferencesTitle.Text = currentReference.Title;
txtReferencesFirstName.Text = currentReference.FirstName;
txtReferencesLastName.Text = currentReference.LastName;
txtReferencesAcadTitle.Text = currentReference.AcadTitle;
txtReferencesExpertise.Text = currentReference.Expertise;
txtReferencesDepartment.Text = currentReference.Dept;
txtReferencesInstitute.Text = currentReference.Institution;
txtReferencesAddress1.Text = currentReference.Address1;
txtReferencesAddress2.Text = currentReference.Address2;
txtReferencesCity.Text = currentReference.City;
txtReferencesState.Text = currentReference.State;
txtReferencesZip.Text = currentReference.Zip;
txtReferencesCountry.Text = currentReference.Country;
txtReferencesPhone.Text = currentReference.Phone;
txtReferencesEmail.Text = currentReference.Email;
//Now show the popup control
mpopupReferencesEntry.Show();
}