}//void getfacultydata(Object sender, EventArgs e) //function to add the event on the button click for the staffdata void getstaffdata(Object sender, EventArgs e) { Button clickedButton = (Button)sender; string username = clickedButton.Name; string faculty = getRestData("/people/staff/username=" + username); PeopleDetails facultydata = JToken.Parse(faculty).ToObject <PeopleDetails>(); PeopleData peopledetails = new PeopleData(facultydata); peopledetails.ShowDialog(); }//void getstaffdata(Object sender, EventArgs e)
public PeopleData(object sender) { InitializeComponent(); PeopleDetails peopledata = sender as PeopleDetails; pictureBox1.ImageLocation = peopledata.imagePath; label1.Text = peopledata.name; label2.Text = peopledata.title; label3.Text = "Website: " + peopledata.website; label4.Text = "Office: " + peopledata.office; label5.Text = "Email: " + peopledata.email; }