/// <summary> /// Sets any missing required field error indicators. /// </summary> /// <param name="parentControl">The parent control.</param> /// <param name="item">The item.</param> public static void SetErrorIndicators(Control parentControl, IHasAttributes item) { if (item.Attributes != null) { foreach (var attribute in item.Attributes) { if (attribute.Value.IsRequired) { HtmlGenericControl div = parentControl.FindControl(string.Format("attribute_{0}", attribute.Value.Id)) as HtmlGenericControl; RequiredFieldValidator rfv = parentControl.FindControl(string.Format("attribute_rfv_{0}", attribute.Value.Id)) as RequiredFieldValidator; if (div != null && rfv != null) { if (rfv.IsValid) { div.RemoveCssClass("error"); } else { div.AddCssClass("error"); } } } } } }
void lb_Click(object sender, EventArgs e) { if (CurrentPersonId.HasValue) { LinkButton lb = sender as LinkButton; if (lb != null) { int groupId = 0; if (Int32.TryParse(lb.Attributes["group"], out groupId)) { int roleId = 0; if (!Int32.TryParse(AttributeValue("GroupRole"), out roleId)) { roleId = 0; } var group = groupService.Get(groupId); if (group != null && group.AttributeValues.ContainsKey(_videoAttributeKey)) { hfVideoUrl.Value = group.AttributeValues[_videoAttributeKey].Value[0].Value; MemberService memberService = new MemberService(); var groupMember = memberService.GetByGroupIdAndPersonIdAndGroupRoleId( groupId, CurrentPersonId.Value, roleId); if (groupMember == null) { groupMember = new Member(); groupMember.GroupId = groupId; groupMember.PersonId = CurrentPersonId.Value; groupMember.GroupRoleId = roleId; memberService.Add(groupMember, CurrentPersonId); memberService.Save(groupMember, CurrentPersonId); } HtmlGenericControl li = lb.Parent as HtmlGenericControl; if (li != null) { li.RemoveCssClass("not-viewed"); li.AddCssClass("viewed"); } } } } } }