public void Bind(IList <Category> categories) { var items = new List <Item>(); List <NewsGridItem> gridItems = new List <NewsGridItem>(); //change this to include ItemTypeId(news,Doco,Forum) so it only search selected versions. List <VersionItem> latestDrafts = VersionManager.GetAllLatestDrafts(); //Binding all Published news with their corresponding latest version. foreach (VersionItem draft in latestDrafts) { List <Item> newsItems = new List <Item>(); //get all versions by groupID IList <VersionItem> versionedItems = VersionManager.GetAllVersions(draft.GroupId); foreach (VersionItem item in versionedItems) { //add all published ones to newsItems list string pubId = ItemApprovalStatusManager.GetStatusByName("Published").Id; Item itemX = NewsManager.GetItem(item.ItemId); if (itemX != null) { if (itemX.ApprovalStatus != null) { if (itemX.ApprovalStatus.Id.Equals(pubId) && item.Deleted == false) { newsItems.Add(itemX); } } } } //sort them by date inserted- DESC and get the first one. if (newsItems.Count > 0) { Item newsItem = newsItems.OrderByDescending(x => x.InsertDate).First <Item>(); gridItems.Add(new NewsGridItem() { Draft = draft, NewsItem = newsItem }); } else//no published item found - get the latest draft and its corresponding newsItem { VersionItem latestDraft = VersionManager.GetVersionByGroupId(draft.GroupId); Item newsItem = NewsManager.GetItem(latestDraft.ItemId); gridItems.Add(new NewsGridItem() { Draft = draft, NewsItem = newsItem }); } } //do a 1-1 news & draft comparison to check whether all news have corresponding draft or not if not then add it to the grid. Pressing edit will create its first version. foreach (Category category in categories) { IList <Item> childItems = NewsManager.GetItems(category, false); foreach (Item newsItem in childItems) { VersionItem versionItem = VersionManager.GetVersionByItemId(newsItem.Id); if (versionItem == null && newsItem.ApprovalStatus == null) { versionItem = new VersionItem(); versionItem.ItemId = newsItem.Id; versionItem.GroupId = newsItem.Id; gridItems.Add(new NewsGridItem() { Draft = versionItem, NewsItem = newsItem }); } } } List <NewsGridItem> gridItemsPermission = new List <NewsGridItem>(); foreach (var gi in gridItems) { if (gi.NewsItem != null) { if (SecurityHelper.CanUserEdit(Page.User.Identity.Name, gi.NewsItem.Category.Id) || SecurityHelper.CanUserContribute(Page.User.Identity.Name, gi.NewsItem.Category.Id)) { gridItemsPermission.Add(gi); } } } RadGridManage.DataSource = gridItemsPermission; }