Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Chris Parkinson 39 posts 73 karma points
    Mar 04, 2013 @ 10:53
    Chris Parkinson
    0

    ICustomTypeConvertor not supported?

    Hi

    I've got a site running uSiteBuilder 1.2 that utilises ICustomTypeConvertor quite heavily. After installing this package (thus now using the forked version of uSiteBuilder) these are no longer working. I'm getting exceptions trying to convert from strings to my custom types. 

    Is ICustomTypeConvertor not supported in this version of uSiteBuilder?

  • Stephen 47 posts 270 karma points
    Mar 04, 2013 @ 11:10
    Stephen
    0

    Have you got an example of the error you're getting?

    I have changed the way the CustomTypeConvertors were working, they used to be held in a dictionary that was keyed on the return type but I sometimes had different convertors returning the same type (like List<string> say) so this approach wouldn't work. 

    I now allow them to be configured on the doc type property itself, like below. 

    I can have a look into the error you are getting as you should still be able to do both ways I guess.

     

            [DocumentTypeProperty(
                UmbracoPropertyType.Other,
                OtherTypeName = "Energy Item Selector",
                Name = "Energy Features Third Row",
                Description = "Select the featured items for the third Energy feature row",
                Tab = "Energy",
                CustomTypeConverter = typeof(MultiNodeTreePickerConverter),
                Mandatory = false)]
            public List EnergyFeatureSet3 { get; set; }
    

    Stephen

  • Chris Parkinson 39 posts 73 karma points
    Mar 04, 2013 @ 11:36
    Chris Parkinson
    0

    Specifying the CustomTypeConvertor seems to fix the issue. 

    For info the error is:

    Server Error in '/' Application.


    Cannot set the value of a document type property StandardContentPage.Image (document type: GrahamWebsite.Core.DataTypes.ImagePicker.ImagePicker) to value: '' (value type: System.String). Error: Object of type 'System.String' cannot be converted to type 'GrahamWebsite.Core.DataTypes.ImagePicker.ImagePicker'.

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

    Exception Details: System.Exception: Cannot set the value of a document type property StandardContentPage.Image (document type: GrahamWebsite.Core.DataTypes.ImagePicker.ImagePicker) to value: '' (value type: System.String). Error: Object of type 'System.String' cannot be converted to type 'GrahamWebsite.Core.DataTypes.ImagePicker.ImagePicker'.

    Source Error: 

    Line 79:             StringBuilder sb = new StringBuilder();
    Line 80: 
    Line 81: sb.AppendFormat("<title>{0} | Graham</title>", !String.IsNullOrEmpty(CurrentContent.MetaTitle) ? CurrentContent.MetaTitle : CurrentContent.Name); Line 82:             
    Line 83:             if (!String.IsNullOrEmpty(CurrentContent.MetaDescription))


    Source File: c:\tfs\GrahamWebsite\New Website\Dev\Solution\GrahamWebsite.Web\masterpages\DefaultMasterPage.Master.cs    Line: 81 

    Stack Trace: 

    [Exception: Cannot set the value of a document type property StandardContentPage.Image (document type: GrahamWebsite.Core.DataTypes.ImagePicker.ImagePicker) to value: '' (value type: System.String). Error: Object of type 'System.String' cannot be converted to type 'GrahamWebsite.Core.DataTypes.ImagePicker.ImagePicker'.]
       Vega.USiteBuilder.ContentHelper.GetByNode(Node node) +1629
       Vega.USiteBuilder.ContentHelper.GetByNode(Node node) +23
       Vega.USiteBuilder.ContentHelper.GetByNodeId(Int32 nodeId) +66
       Vega.USiteBuilder.TemplateBase`1.get_CurrentContent() +178
       GrahamWebsite.Web.masterpages.DefaultMasterPage.RenderMetaData() in c:\tfs\GrahamWebsite\New Website\Dev\Solution\GrahamWebsite.Web\masterpages\DefaultMasterPage.Master.cs:81
       ASP.masterpages_defaultmasterpage_master.__RenderMetaDataContentPlaceHolder(HtmlTextWriter __w, Control parameterContainer) in c:\tfs\GrahamWebsite\New Website\Dev\Solution\GrahamWebsite.Web\masterpages\DefaultMasterPage.Master:15
       System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +268
       System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +8
       System.Web.UI.Control.Render(HtmlTextWriter writer) +10
       System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +57
       System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100
       System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
       ASP.masterpages_defaultmasterpage_master.__Render__control2(HtmlTextWriter __w, Control parameterContainer) in c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\54cbe609\e571ac61\App_Web_defaultmasterpage.master.7371103c.kackzvzx.0.cs:0
       System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +268
       System.Web.UI.HtmlControls.HtmlHead.RenderChildren(HtmlTextWriter writer) +21
       System.Web.UI.HtmlControls.HtmlContainerControl.Render(HtmlTextWriter writer) +32
       System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +57
       System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100
       System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
       ASP.masterpages_defaultmasterpage_master.__Render__control1(HtmlTextWriter __w, Control parameterContainer) in c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\54cbe609\e571ac61\App_Web_defaultmasterpage.master.7371103c.kackzvzx.0.cs:0
       System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +268
       System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +8
       System.Web.UI.Control.Render(HtmlTextWriter writer) +10
       System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +57
       System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100
       System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
       System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +128
       System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +8
       System.Web.UI.Control.Render(HtmlTextWriter writer) +10
       System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +57
       System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100
       System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
       System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +128
       System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +8
       System.Web.UI.Control.Render(HtmlTextWriter writer) +10
       System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +57
       System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100
       System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
       System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +128
       System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +8
       umbraco.UmbracoDefault.Render(HtmlTextWriter writer) +74
       System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +57
       System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100
       System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1386
    



    Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.17929

  • Matt Taylor 873 posts 2086 karma points
    Jul 29, 2013 @ 14:54
    Matt Taylor
    0

    Oh dear, we've just added the Admin package to our 4.11 project and found the problem.

    We've got a handful of converters and would hate to refactor them.

    I hope there's a solution?

    Regards,

    Matt

  • Matt Taylor 873 posts 2086 karma points
    Jul 29, 2013 @ 15:11
    Matt Taylor
    0

    Ah, I should have read the replies more closely although a resolved marker would have been helpful.

    I'll give the fix a go. :-)

Please Sign in or register to post replies

Write your reply to:

Draft