This question is locked. New answers and comments are not allowed.
Is this bad query syntax perhaps somewhere?....if I enable both of these I go from 1 second page load to 10 seconds.
protected void RadGrid1_NeedDataSource(object source, GridNeedDataSourceEventArgs e) {/* var filtered = (from r in this.Requests select new { ApprovalID = r.SittingWithApprovalID, SittingWithApprovalID = r.SittingWithApprovalID, SittingWithApprovalChainLevel = r.SittingWithApprovalChainLevel, CreateDate = r.SittingWithApproverCreatedDate, StatusText = r.Status, ResidentEmail = r.ResidentEmail }); debugLabel.Text = this.Email; ((RadGrid)source).DataSource = filtered.Distinct().OrderByDescending(x => x.CreateDate); */} protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) { /* if (e.Item is GridDataItem) { try { GridDataItem item = e.Item as GridDataItem; if (Request.QueryString["GUID"] != null) { if (item["SittingWithApprovalID"].Text.ToString() == Request.QueryString["GUID"].ToString()) ((GridDataItem)e.Item).Display = false; Guid approvalid = new Guid(item["SittingWithApprovalID"].Text); //RTODataLayer.Approval approval = RTOHelper.RTOScope.Extent<RTODataLayer.Approval>().FirstOrDefault(x => x.ApprovalID == approvalid); List<ViewAllRequest> dates = (from d in this.Requests where d.Active != 'N' && d.SittingWithApprovalID == approvalid select d).ToList(); int totalCount = dates.Count; int expiredCount = 0; foreach (RTODataLayer.ViewAllRequest date in dates) { if (DateTime.Now > date.FromDate) expiredCount++; } item["NoticeColumn"].Text = totalCount + " dates"; if (expiredCount > 0) item["NoticeColumn"].Text += "<br /><span style='color:#c00300'>" + expiredCount + " are expired</span>"; } else { if (item["SittingWithApprovalID"].Text.ToString() == this.AlreadyViewingThisApprovalID) ((GridDataItem)e.Item).Display = false; } }catch(Exception ex){ } }*/ }private List<ViewAllRequest> _requests = null;public List<ViewAllRequest> Requests{ get{ if (_requests == null) { RTODataLayer.Approver approver = null; if (Membership.GetUser() != null) approver = RTOHelper.RTOScope.Extent<RTODataLayer.Approver>().FirstOrDefault(x => x.MedportalUID == new Guid(Membership.GetUser().ProviderUserKey.ToString())); if (approver != null) { _requests = (from r in RTOHelper.RTOScope.Extent<RTODataLayer.ViewAllRequest>() where (r.SittingWith.Contains(this.Email) || r.SittingWith.Contains(approver.ApproverName)) && r.Status.Contains("Pending") select r).ToList(); } else { _requests = (from r in RTOHelper.RTOScope.Extent<RTODataLayer.ViewAllRequest>() where (r.SittingWith.Contains(this.Email)) && r.Status.Contains("Pending") select r).ToList(); } } return _requests; }}