protected void ProjectsRepeater_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType != ListItemType.Item && e.Item.ItemType != ListItemType.AlternatingItem) { return; } //Change the text of confirmation message of delete button LinkButton buttonDelete = (LinkButton)e.Item.FindControl("DeleteProject"); if (buttonDelete != null) { buttonDelete.OnClientClick = String.Format("return confirm('{0}')", Resources.Project.MessageConfirmDelete); } Project item = (Project)e.Item.DataItem; if (item == null) { return; } //If exists AreaName Show the GuionLabel if (!string.IsNullOrEmpty(item.AreaName)) { Label theGuion = (Label)e.Item.FindControl("GuionLabel"); if (theGuion != null) { theGuion.Visible = true; } } //Show the delete button if is Owner HiddenField theHFOwner = (HiddenField)e.Item.FindControl("IsOwnerHiddenField"); if (theHFOwner != null) { if (!Convert.ToBoolean(theHFOwner.Value)) { Panel panelDelete = (Panel)e.Item.FindControl("pnlDelete"); if (panelDelete != null) { panelDelete.CssClass = "col-md-1 col-sm-1 col-xs-3 disabled"; } Panel panelShare = (Panel)e.Item.FindControl("pnlShare"); if (panelShare != null) { panelShare.CssClass = "col-md-1 col-sm-1 col-xs-3 disabled"; } } } //Activities ActivityBLL theACBLL = new ActivityBLL(); List <Activity> theActivities = new List <Activity>(); try { theActivities = theACBLL.GetActivitiesByProject(item.ProjectID); } catch { } if (theActivities.Count == 0 && item.NumberOfKpis == 0) { Panel element = (Panel)e.Item.FindControl("emptyMessage"); element.Visible = true; return; } Panel detailsPanel = (Panel)e.Item.FindControl("detailsContainer"); detailsPanel.Visible = true; Panel kpiImagePanel = (Panel)e.Item.FindControl("KpiImageContainer"); kpiImagePanel.Visible = true; LinkButton activitiesButton = (LinkButton)e.Item.FindControl("ActivitiesButton"); LinkButton kpisButton = (LinkButton)e.Item.FindControl("KpisButton"); Literal and = (Literal)e.Item.FindControl("AndLiteral"); activitiesButton.Visible = theActivities.Count > 0; activitiesButton.Text = activitiesButton.Visible ? theActivities.Count + (theActivities.Count == 1 ? " " + Resources.Organization.LabelActivity : " " + Resources.Organization.LabelActivities) : ""; kpisButton.Visible = item.NumberOfKpis > 0; kpisButton.Text = kpisButton.Visible ? item.NumberOfKpis + " KPI(s)" : ""; and.Visible = activitiesButton.Visible && kpisButton.Visible; }