private void SearchButton_Click(object sender, RoutedEventArgs e) { int id = Int32.Parse(idText.Text); Advertisement rslt = AdvertisementController.SearchByID(id); if (rslt != null) { advertisementDescriptionText.Text = rslt.AdvertisementDescription; AdsDeadline.SelectedDate = rslt.Deadline; } }