Sharepoint 2010 - Chart web part


Figure1: Two chart web parts in one page

Since chart controls of asp.net 4 cant be used in SharePoint 2010 (.NET 3.5) we have decided to use DevExpress chart controls in our web parts. Here are the steps necessary to do so:

1. Install devexpress in the machine

2. Create a Visual web part using visual studio 2010

3. Add Web chart control to the visual web part

4. Object reference not se to an instance of an object appears

5. open: C:\inetpub\wwwroot\wss\VirtualDirectories\80\web.config

6. Add following controls as safe controls:
DevExpress.XtraCharts.v9.3.Web Namespace="DevExpress.XtraCharts.Web"
DevExpress.Web.ASPxEditors.v9.3 Namespace="DevExpress.Web.ASPxEditors"
DevExpress.XtraCharts.v9.3 Namespace="DevExpress.XtraCharts"
DevExpress.Data.v9.3 Namespace="DevExpress.Utils.Serializing.Helpers"

7. Add reference to:
DevExpress.BonusSkins.v9.3.dll
DevExpress.Charts.v9.3.Core.dll
DevExpress.Data.v9.3.dll
DevExpress.OfficeSkins.v9.3.dll
DevExpress.Utils.v9.3.dll
DevExpress.Web.v9.3.dll
DevExpress.Web.ASPxThemes.v9.3.dll
DevExpress.XtraCharts.v9.3.dll
DevExpress.XtraCharts.v9.3.UI.dll
DevExpress.XtraCharts.v9.3.Web.dll
DevExpress.XtraEditors.v9.3.dll
DevExpress.XtraNavBar.v9.3.dll

8. Register assemblies in ascx file
DevExpress.Charts.v9.3.Core Namespace="DevExpress.Charts.Native"
DevExpress.Data.v9.3 Namespace="DevExpress.Utils.Serializing.Helpers"
"DevExpress.Web.v9.3 Namespace="DevExpress.Web.ASPxClasses"
"DevExpress.Web.ASPxEditors.v9.3 Namespace="DevExpress.Web.ASPxEditors"
"DevExpress.XtraCharts.v9.3 Namespace="DevExpress.XtraCharts"
"DevExpress.XtraCharts.v9.3.Web Namespace="DevExpress.XtraCharts.Web"

No comments:

Post a Comment