SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am having a big trouble with showing data in a gridview.

All the guides on the internet is using LINQ, but i can not use that, because i create new Lists in Sharepoint, that therefore would not be in the entity class file.

I would be really glad if somebody could show how to get data from a list and show it in a webpart wihout LINQ:

I have this now:

        SPSite _sc = SPContext.Current.Site;
        SPWeb _w = _sc.OpenWeb();
        SPList l = _w.Lists["Navne"];
        SPListItemCollection lic = l.Items;
        foreach (SPListItem item in lic)

I have searched to find the solution, but no answers.

share|improve this question
all lists generate a webpart bound to this list. What's wrong with it ? – Steve B Jun 25 '12 at 10:11
Because i will take multiple list and combine them into one. – Kevin Simper Jun 25 '12 at 10:37
Is there any common content type ancestor? if yes, this can be native. which edition of SP do you own ? – Steve B Jun 25 '12 at 10:59
I am using Sharepoint Online, so that must be Foundation. – Kevin Simper Jun 25 '12 at 11:00
SharePoint Online uses SharePoint Server 2010 – Vardhaman Deshpande Jun 25 '12 at 11:05
up vote 0 down vote accepted

In these 101 samples from Microsoft there is an example on how to use the Gridview.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.