Copied to clipboard

Flag this post as spam?

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


  • Loren Bourne 1 post 21 karma points
    Feb 13, 2013 @ 12:46
    Loren Bourne
    0

    WidgetGrid property value returned as json even though xml selected

    I need a bit of help with WidgetGrid usage in a custom publish event handler.

    I have defined a property, panelPicker, as an xml stored WidgetGrid data type and would like to process the property value as part of a custom publish event handler. 

    Have therefore defined an after publish event:

            void Document_AfterPublish(Document sender, umbraco.cms.businesslogic.PublishEventArgs e)
            {
                if (sender.ContentType.Alias == "landing") {
                    NavigationManager.Instance.updateNavRelations(sender);
                }
            }

    and a corresponding method to process the document:

            public void updateNavRelations(Document d)
            {
                if (d.ContentType.Alias == "landing")
                {
                    Debug.WriteLine(d.getProperty("panelPicker").Value.ToString());
                    XmlDocument xmlDoc = new XmlDocument();
                    try
                    {
                        xmlDoc.LoadXml(d.getProperty("panelPicker").Value.ToString());
                        Debug.WriteLine(xmlDoc.ToString());
                    }
                    catch (Exception ex)
                    {                    
                        throw;
                    }                
                }
            }

    The property value is however returned as json despite the storage type being defined as xml. The database shows the property correctly stored as xml.

    Any suggestions greatly appreciated.

Please Sign in or register to post replies

Write your reply to:

Draft