Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I'm trying to connect the SharePoint 2010 Chart Web Part to SharePoint list. It's all good but anonymous can't see the chart and I get this error:

Object reference not set to an instance of an object. System.NullReferenceException: Object reference not set to an instance of an object. at Microsoft.Office.Server.WebControls.Chart.RenderChartControl(Control chartToRender, HtmlTextWriter writer) at Microsoft.Office.Server.WebControls.Chart.Render(HtmlTextWriter writer) at Microsoft.Office.Server.WebControls.ChartWebPart.Render(HtmlTextWriter writer)

share|improve this question
add comment

4 Answers

up vote 1 down vote accepted

This is a bug and it's solved in SP2010 SP1 (didn't test it though). Here is the link to the kb article which describes all the changes in the xslx file: http://support.microsoft.com/kb/2460045 Row 234 describes the issue you're referring to.

share|improve this answer
add comment

Not enough info to answer. What other info is in SharePoint Logs? Try to attach debugger or use logging. Most likely smth is not initialized before accessing.

UPD: Are all resources used be the page published?

UPD2: MichaelF has a point. Have you tired using smth like:

SPSecurity.RunWithElevatedPrivileges(delegate
{
 // Code goes here
}

?

share|improve this answer
    
I didn't find any usefull data about this on Sharepoint Logs –  Hameds Apr 27 '11 at 14:52
    
How to attach debugger? –  Hameds Apr 29 '11 at 16:53
    
System.Diagnostics.Debugger.Break(); –  AlexSSE Apr 30 '11 at 11:01
    
Do you need to use elevated permissions with this? I know we do that for certain web parts in our environment to get data that normally would be restricted. –  MichaelF May 3 '11 at 17:30
1  
I dont think he can add the SPSecurity becuase he is using an OOTB web part... –  JohnnyT May 4 '11 at 18:11
show 1 more comment

If the problem is that autenticated users see the chart, but anonymous don't, the problem is probably a permissions-issue. Make sure that no files you use needs restricted access.

If you don't figure it out, do as @Disciple suggested, attach a debugger.

share|improve this answer
add comment

I'm not that familiar with the Chart web part but from checking it out my guess is that it have the same issues with anonymous user as client object model based web parts (like Silverlight based web parts) have.
The problem is that by default SharePoint restrict the GetItems method of SPLIst for anonymous users.
You should check out Waldek Mastykarz's post about this issue, but to summarize his great solution, use the following PowerShell code (dont forget to replace http://sharepoint with your site url):

$wa = Get-SPWebApplication -Identity "http://sharepoint"
$wa.ClientCallableSettings.AnonymousRestrictedTypes.Remove([Microsoft.SharePoint.SPList], "GetItems")
$wa.Update()
share|improve this answer
    
Thanks, I'm gonna try this –  Hameds Apr 30 '11 at 9:12
add comment

Your Answer

 
discard

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.