This is a migrated thread and some comments may be shown as answers.

Binding RadGrid to Data from Session

0 Answers 197 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
InfySam
Top achievements
Rank 1
InfySam asked on 06 Jun 2012, 10:13 PM
Hi,

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;
            MentorDetailsGrid.DataBind();
            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?

Thanks.

No answers yet. Maybe you can help?

Tags
General Discussions
Asked by
InfySam
Top achievements
Rank 1
Share this question
or