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

For a project, I've created a web-part which derives from the ChartWebPart class (in order to set the data-source relatively).

SP:

SharePoint Server 2010 (Enterprise)

cs-file:

using System;
using System.ComponentModel;
using System.Web;
using System.Web.UI;
using System.Web.UI.DataVisualization.Charting;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using Microsoft.Office.Server.WebControls;
using Microsoft.SharePoint;
using Microsoft.SharePoint.WebControls;

namespace Cbs.PP.ProjectCosts.WebParts.ProjectExpensesChartWebPart
{
    [Serializable()]
    [ToolboxItemAttribute(false)]
    public class ProjectExpensesChartWebPart : ChartWebPart
    {
        public ProjectExpensesChartWebPart()
        { 
        }

        protected override void CreateChildControls()
        {
            base.CreateChildControls();
        }

    }
}

Elements.xml:

<?xml version="1.0" encoding="utf-8"?>
  <Elements xmlns="http://schemas.microsoft.com/sharepoint/" >
    <Module Name="ProjectExpensesChartWebPart" List="113" Url="_catalogs/wp">
      <File Path="ProjectExpensesChartWebPart\ProjectExpensesChartWebPart.webpart"
            Url="ProjectExpensesChartWebPart.webpart" 
            Type="GhostableInLibrary">
        <Property Name="Group" Value="CBS" />
      </File>
    </Module>
  </Elements>

Deploying the web-part and adding it to a site is no problem, but when I try to configure the webpart, it throws an exeption:

Type: SerializationException Message: The constructor which is needed for the deserialization of an object of the type "[...].ProjectExpensesChartWebPart" couldn't be found.*

*note: translation, since I have the german version of SP installed. Original: "Der für die Deserialisierung eines Objekts mit dem Typ "[...].ProjectExpensesChartWebPart" erforderliche Konstruktor wurde nicht gefunden."

I hope that someone has a clue, what's wrong here, or can at least point me in the right direction.

also, the Stacktrace:

bei System.Runtime.Serialization.ObjectManager.CompleteISerializableObject(Object obj, SerializationInfo info, StreamingContext context) bei System.Runtime.Serialization.ObjectManager.FixupSpecialObject(ObjectHolder holder)
bei System.Runtime.Serialization.ObjectManager.DoFixups() bei System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize(HeaderHandler handler, __BinaryParser serParser, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage) bei System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream, HeaderHandler handler, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage) bei System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream) bei Microsoft.Office.Server.Internal.Charting.Utilities.ChartAdminPageBase.get_currentWorkingSet() bei Microsoft.Office.Server.Internal.Charting.Utilities.ChartAdminPageBase.FetchFromCurrentWorkingSet(String key) bei Microsoft.Office.Server.Internal.Charting.UI.WizardConnectToDataPage.LoadModel() bei Microsoft.Office.Server.Internal.Charting.UI.WizardConnectToDataPage.OnLoad(EventArgs e) bei System.Web.UI.Control.LoadRecursive() bei System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

I think you have to add the constructor ProjectExpensesChartWebPart(SerializationInfo info, StreamingContext context) addintionally to the default constructor.

share|improve this answer
    
Thanks man, that was much, much easier than I expected. :D –  Markus Schwalbe May 31 '11 at 12:28
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.