/// <summary> /// Handles the Click event of the btnAddLocation control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> protected void btnAddLocation_Click(object sender, EventArgs e) { CheckinGroupEditor checkinGroupEditor = phCheckinGroupTypes.ControlsOfTypeRecursive <CheckinGroupEditor>().FirstOrDefault(a => a.GroupGuid == new Guid(hfAddLocationGroupGuid.Value)); checkinGroupEditor.ForceContentVisible = true; (checkinGroupEditor.Parent as CheckinGroupTypeEditor).ForceContentVisible = true; CheckinGroupEditor.LocationGridItem gridItem = new CheckinGroupEditor.LocationGridItem(); gridItem.LocationId = ddlLocation.SelectedValueAsId() ?? 0; gridItem.Name = ddlLocation.SelectedItem.Text; checkinGroupEditor.Locations.Add(gridItem); pnlLocationPicker.Visible = false; pnlDetails.Visible = true; }
/// <summary> /// Handles the Click event of the btnAddLocation control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> protected void btnAddLocation_Click(object sender, EventArgs e) { CheckinGroupEditor checkinGroupEditor = phCheckinGroupTypes.ControlsOfTypeRecursive <CheckinGroupEditor>().FirstOrDefault(a => a.GroupGuid == new Guid(hfAddLocationGroupGuid.Value)); // Add the location (ignore if they didn't pick one, or they picked one that already is selected) if (locationPicker.Location != null) { if (!checkinGroupEditor.Locations.Any(a => a.LocationId == locationPicker.Location.Id)) { CheckinGroupEditor.LocationGridItem gridItem = new CheckinGroupEditor.LocationGridItem(); gridItem.LocationId = locationPicker.Location.Id; gridItem.Name = locationPicker.Location.Name; checkinGroupEditor.Locations.Add(gridItem); } } checkinGroupEditor.ForceContentVisible = true; (checkinGroupEditor.Parent as CheckinGroupTypeEditor).ForceContentVisible = true; mdLocationPicker.Hide(); }