protected void RegistrationRepeater_ItemDataBound(Object Sender, RepeaterItemEventArgs e) { // Execute the following logic for Items and Alternating Items. if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { System.Data.Common.DbDataRecord rd = (System.Data.Common.DbDataRecord)e.Item.DataItem; CheckForDatelessEventTypes(e, rd); if (DisplayEventTypeIDSetting.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries).Length > 0) { e.Item.Visible = ItemIsEventType(e, rd); } } }
protected bool ItemIsEventType(RepeaterItemEventArgs e, System.Data.Common.DbDataRecord rd) { string[] displayEventTypes = DisplayEventTypeIDSetting.Split(','); String type_luid = (rd)["type_luid"].ToString(); return(displayEventTypes.Contains(type_luid)); //foreach (string eventType in displayEventTypes) //{ // if (eventType.Trim() == type_luid.Trim()) // { // DisplayEventType = true; // } // else // { // DisplayEventType = false; // break; // } //} //return DisplayEventType; }
/// <summary> /// Returns true if the Event Type ID is found in the DisplayEventTypeIDSetting array.</summary> /// <param name="eventTypeId">The ID of the event being tested.</param> protected bool ItemIsEventType(int eventTypeId) { int number; bool result = Int32.TryParse(eventTypeId.ToString(), out number); if (result) { string[] displayEventTypes = DisplayEventTypeIDSetting.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); if (displayEventTypes.Length > 0) { return(displayEventTypes.Contains(eventTypeId.ToString())); } else { return(true); } } else { return(false); } }