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

RadGrid Connected to SharePoint 2010 Data with Design Time Support

1 Answer 47 Views
WebParts for SharePoint
This is a migrated thread and some comments may be shown as answers.
Ronald
Top achievements
Rank 1
Ronald asked on 03 Oct 2012, 04:16 PM
Does anyone have a good technique for connecting a RadGrid to a SharePoint list while still keeping all the design time features of the RadGrid? I don't. Here's everything I've tried and what sucks about it. BTW, I'm not blaming Telerik. This is more of a VS <--> SP problem.

Using SP Metal, I've create all the classes to connect to my SharePoint data. Now I'm stuck at connecting this to a RadGrid (or even a built in GridView). You have to have a data source to connect to. Logic says that you should use a LinqDataSource. Unfortunately, that control isn't "native" to the SP visual web part template. You'll have to go into the ascx and add <%@ Register Tagprefix="aspweb" Namespace="System.Web.UI.WebControls" Assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" %> so that you can use <aspweb:LinqDataSource />. The RadGrid easily connects to the LinqDataSource, but you can't configure the LinqDataSource to connect DataContext object created with SP Metal. The only thing I can find online is using the Selecting event of the LinqDataSource to populate the data, or not using the LinqDataSource and populate the RadGrid's DataSource in the page Load event, or the RadGrid's NeedDataSource event. All of those options destroy the chance to use the nice design-time editor Telerik has designed for the RadGrid.

I've tried this same thing outside of a SP template and had no problems (aside from an annoying Microsoft.Sharepoint.Sandbox.dll file that keeps getting added to the bin\ folder that you have to delete).

Am I missing something? I doubt I'm the only one trying to display SP list data in a grid and use the editor to do my styling. This is driving me up a wall. I've thought about creating all the user controls outside of a SP template and then trying to load those, or creating my own type of data source to wrap around the Metal classes, but this seems a bit too complicated. Am I doing something wrong, or does anyone have a clean solution to my problem?


1 Answer, 1 is accepted

Sort by
0
Tsvetoslav
Telerik team
answered on 09 Oct 2012, 06:58 AM
Hi Ronald,

You are correct that you do need a DataSource control to get the design-time support for RadGrid's columns. Otherwise, the grid does not have a way to know what data will be coming into and in what structure. The other option is to statically design the columns and all the other properties and then pass the data in the NeedDataSource event, but then you have to know what column fields the data contains.

Greetings, Tsvetoslav
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
WebParts for SharePoint
Asked by
Ronald
Top achievements
Rank 1
Answers by
Tsvetoslav
Telerik team
Share this question
or