/// <summary> /// Handles the RowDataBound event of the gRecordings control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="GridViewRowEventArgs" /> instance containing the event data.</param> protected void gRecordings_RowDataBound(object sender, GridViewRowEventArgs e) { if (_canEdit) { Recording recording = e.Row.DataItem as Recording; LinkButton lbStart = (LinkButton)e.Row.FindControl("lbStart"); LinkButton lbStop = (LinkButton)e.Row.FindControl("lbStop"); if (recording != null && lbStart != null && lbStop != null) { lbStart.Enabled = !recording.StartTime.HasValue && !recording.StopTime.HasValue; lbStop.Enabled = recording.StartTime.HasValue && !recording.StopTime.HasValue; if (lbStart.Enabled) { lbStart.RemoveCssClass("disabled"); } else { lbStart.AddCssClass("disabled"); } if (lbStop.Enabled) { lbStop.RemoveCssClass("disabled"); } else { lbStop.AddCssClass("disabled"); } } } }
/// <summary> /// Handles the ItemDataBound event of the rptSelectTemplate control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="RepeaterItemEventArgs"/> instance containing the event data.</param> protected void rptSelectTemplate_ItemDataBound(object sender, RepeaterItemEventArgs e) { CommunicationTemplate communicationTemplate = e.Item.DataItem as CommunicationTemplate; if (communicationTemplate != null) { Literal lTemplateImagePreview = e.Item.FindControl("lTemplateImagePreview") as Literal; Literal lTemplateName = e.Item.FindControl("lTemplateName") as Literal; Literal lTemplateDescription = e.Item.FindControl("lTemplateDescription") as Literal; LinkButton btnSelectTemplate = e.Item.FindControl("btnSelectTemplate") as LinkButton; if (communicationTemplate.ImageFileId.HasValue) { var imageUrl = string.Format("~/GetImage.ashx?id={0}", communicationTemplate.ImageFileId); lTemplateImagePreview.Text = string.Format("<img src='{0}' width='100%'/>", this.ResolveRockUrl(imageUrl)); } else { lTemplateImagePreview.Text = string.Format("<img src='{0}'/>", this.ResolveRockUrl("~/Assets/Images/communication-template-default.svg")); } lTemplateName.Text = communicationTemplate.Name; lTemplateDescription.Text = communicationTemplate.Description; btnSelectTemplate.CommandName = "CommunicationTemplateId"; btnSelectTemplate.CommandArgument = communicationTemplate.Id.ToString(); if (hfSelectedCommunicationTemplateId.Value == communicationTemplate.Id.ToString()) { btnSelectTemplate.AddCssClass("template-selected"); } else { btnSelectTemplate.RemoveCssClass("template-selected"); } } }