protected void AddTopListControl(TopListDashboardElement elem, Control container) { TopList topList = new TopList(); topList.Width = new Unit(48, UnitType.Percentage); topList.Period = elem.Period; topList.Height = new Unit(GetTopListHeightInPixels(elem)); topList.TopListClass = elem.TopListElementClass; topList.ShowPieChart = elem.ShowChart; topList.NumberOfElements = elem.NumberListItemsToShow; if (elem.ShowChart) { topList.Height = new Unit(615, UnitType.Pixel); } else { topList.Height = new Unit(260, UnitType.Pixel); } container.Controls.Add(topList); }
private int GetTopListHeightInPixels(TopListDashboardElement toplist) { int height = 0; if (toplist.ShowChart) height = height + 360; height = height + (32 + 70); int numElements = toplist.NumberListItemsToShow == 0 ? 5 : toplist.NumberListItemsToShow; height = height + (33 * numElements); return height; }