Binding RadGrid to Data from Session

1 posts, 0 answers
  1. InfySam
    InfySam avatar
    8 posts
    Member since:
    May 2012

    Posted 06 Jun 2012 Link to this post


    I am putting DataSource of RadGrid into a Session and when I've to re-bind the RadGrid I want to use the Session. I tried by using the following code.

    Binding the RdaGrid for the first time,

      var mentors = (dynamicModuleManager.GetDataItems(mentorType)).Where(i => i.Visible == true &&
                    i.Status == ContentLifecycleStatus.Live &&
                    (i.GetValue<IList<Guid>>("mentorshipcategories").Any(j => CategoriesChecked.Contains(j)) ||
                    i.GetValue<IList<Guid>>("industries").Any(j => CategoriesChecked.Contains(j)) ||
                    i.GetValue<IList<Guid>>("businessstages").Any(j => CategoriesChecked.Contains(j))));

                MentorDetailsGrid.DataSource = mentors;
                Session["TempMentorsResult"] = mentors;

    So ultimately mentors variable is of type IQueryable<DynamicContent>.

    Now while rebinding the RadGrid, here are the lines used,

     MentorDetailsGrid.DataSource= Session["TempMentorsResult"];
                    MentorDetailsGrid.DataBind(); //At this point I am getting the run-time error  

    The ObjectScope has already been disposed and it's managed persistent objects can no longer be accessed. The ObjectScope should be disposed at the end of the life cycle of your business logic instance. This can also be done in the Dispose of your ASP page or MVC controller.
    Object name: 'OpenAccessRuntime.EnlistableObjectScope'.

    Can someone please tell me where I am doing wrong?


Back to Top