First, sorry for this relatively simple and stupid question, but the ChartWebPart is probably the worst documented WebPart I've been working with so far. (Official and community side!)
I'll try to explain my situation. We have a team-website site in our solution. (SPS 2010 - Enterprise). On this site there's a list. For every new item in the list, it creates a new websitesite from a template. structure
Structure:
- team-website
- website 1
- website 2
- ...
onOn the template for these websitessites there is (among other elements) a document-list library with a single excel-fileExcel file (.xlsx) and a ChartWebPartChart Web Part. The datasourcedata source of the ChartWebPartChart Web Part is the excel-file.Excel file (using Excel Services) And there is the problem, you see:.
The source for the WebPartweb part can be set absolutely without much hassle and it works as it should. But, since the template is used for these various websites, this isn't a working solution and I haven't figured out a way to set the urlURL relatively on the WPweb part. (Or did I? > see below)
A logical solution for me was it to add a new web-part part to my visual stutio ProjektVisual Studio project, that derives from the ChartWebPartChartWebPart. I checked the msdnMSDN and found the WorkBookUrl-member which sounded promising to me. I overridWorkBookUrl member and overrode the OnInit() method:
protected override void OnInit(EventArgs e)
{
string excelFile = SPContext.Current.Web.ServerRelativeUrl
+ "/Dokumente/siteSheet.xlsx";
this.WorkBookUrl = excelFile;
}
Then I did a test, and it worked like a charm. After that, I made some last changes on the chart's design and saved the websitesite as a template. From this templetetemplate I created a websitesite and... no ChartWebPartChart Web Part. (It is defintelydefinitely there, since the debugger jumps in on the break-pointbreakpoint I set in the OnInit-method method, but I can't see it!)
I don't know what's the problem here. Either my code doesn't workswork in the end or it's something else. I tried some other things too, like editing the DataBindingString, nothing worked.
Please, can someone help me out? I'm seriously dying on this one
EDIT:EDIT: I tried using a list instead, and it worked fine. That still doesn't answersanswer my question, of why it doesn't work with the WorkBookUrl though.