Copied to clipboard

Flag this post as spam?

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


  • Christine Jackson 2 posts 22 karma points
    Nov 20, 2012 @ 15:36
    Christine Jackson
    0

    uComponents DataType Grid output in Razor

    Hi there,

    I'm using the DataType Grid from uComponents (5.1.0) and trying to output the saved data into a razor macro for use on a front end template.

    This is what's saved in the DB.

    <productUses>
        <items>
            <item>
                <data alias="useTitle">Mobile surveys</data>
                <data alias="useDescription">This is some text about how you can use mobile surveys...</data>
            </item>
        </items>
    </productUses>

    Is anyone able to point me in the right direction?

    Thanks,
    Christine

  • Matt Bliss 176 posts 234 karma points c-trib
    Nov 20, 2012 @ 16:15
  • Christine Jackson 2 posts 22 karma points
    Nov 20, 2012 @ 19:43
    Christine Jackson
    0

    Hi,

    Thanks for your reply.  I'm thinking that this should work, but having no luck.

    This is the code of my macro:

    @foreach (uComponents.DataTypes.DataTypeGrid.Model.StoredValueRow item in Model.productUses)
    {
        //code goes here
    }

    And I'm getting the following error on my page "Error loading MacroEngine script" with the following debug trace. 

      Error Loading Razor Script (file: ) Object reference not set to an instance of an object.    at uComponents.DataTypes.DataTypeGrid.DTG_ModelBinder.Init(Int32 CurrentNodeId, String PropertyData, Object& instance)
      at umbraco.MacroEngines.DynamicNode.TryCreateInstanceRazorDataTypeModel(Guid dataType, Type dataTypeType, String value, Object& result)
      at umbraco.MacroEngines.DynamicNode.TryGetMember(GetMemberBinder binder, Object& result)
      at CallSite.Target(Closure , CallSite , Object )
      at ASP._Page_macroscripts_listproductuses_cshtml.Execute() in c:\umbraco\macroScripts\ListProductUses.cshtml:line 1
      at System.Web.WebPages.WebPageBase.ExecutePageHierarchy()
      at System.Web.WebPages.WebPage.ExecutePageHierarchy()
      at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage)
      at umbraco.MacroEngines.RazorMacroEngine.ExecuteRazor(MacroModel macro, INode currentPage)
      at umbraco.MacroEngines.RazorMacroEngine.Execute(MacroModel macro, INode currentPage)

     

    Any ideas?

  • Ove Andersen 435 posts 1541 karma points c-trib
    Jan 05, 2013 @ 11:07
    Ove Andersen
    0

    Could you post the data stored in the grid?

  • Carlos 338 posts 472 karma points
    Jan 24, 2013 @ 22:55
    Carlos
    0

    Was there a solution to this? 

    I have an image and a textstring. 

    Why wouldn't the example in the Wiki work? 

    Why do you have to use the strongly typed option?

    Anyways.  Can someone help me out anyway.

     

    I am using Umbraco 4.9 and uComponents 5.0

    Thanks in advance.

    I have a data type grid. I have a Media Picker and a text string to output.
    Is there a way to get this to work. Thanks. 

  • Scott Robinson 54 posts 75 karma points
    Jul 03, 2013 @ 13:06
    Scott Robinson
    0

    I am also having issues with the documentation on the Wki. Did anyone find a solution?

Please Sign in or register to post replies

Write your reply to:

Draft