protected int GetProductCount(object dataItem) { Vendor v = (Vendor)dataItem; if (_ProductCounts.ContainsKey(v.Id)) { return(_ProductCounts[v.Id]); } int count = ProductDataSource.CountForVendor(v.Id); _ProductCounts[v.Id] = count; return(count); }