Prasad Bolla's SharePoint Blog

Click Here to go through the Interesting posts within my Blog.

Click Here to go through the new posts in my blog.

Thursday, December 01, 2011

Binding Data From SharePoint to SpGridView using SharePoint Linq.

Note:-
Here we are binding the Title Column as well as LookUp Column.

 LinqSampleDataContext context = new
LinqSampleDataContext(SPContext.Current.Web.Url);
                EntityList<SharePoint2010ConceptsItem> Concept =
context.GetList<SharePoint2010ConceptsItem>("SharePoint 2010
Concepts");
                var query = from cs in Concept
                            where cs.Status.Title.ToString() !=
"Completed"
                            orderby cs.Id descending
                            select new
                            {
                                cs.Title,
                                strStatus=cs.Status.Title,
                                cs.Id
                            };
                sgvConcepts.DataSource = query;
                sgvConcepts.DataBind();

No comments:

Post a Comment