Copied to clipboard

Flag this post as spam?

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


  • Solomon Closson 22 posts 42 karma points
    Oct 29, 2014 @ 06:27
    Solomon Closson
    0

    Get values of MultiNode Tree Picker using WebForms engine?

    Hello, have noticed this link here: http://our.umbraco.org/wiki/reference/code-snippets/razor-snippets/get-values-from-ucomponents-multi-node-tree-picker-multiple-textstring

    Looks like it is using Mvc, and their are no example of how to get the values of a Multi Node Tree Picker using WebForms Rendering Engine, instead of Mvc. Can someone please help me understand a way to use this Data Type and get the information with ASP.NET, using WebForms, and in a .cs file please?

    For example, I would get the values of a Nodes property called myProperty like so (where aNode is of type umbraco.NodeFactory.Node):

    if (aNode.GetProperty("myProperty") != null)
    {
        if (int.TryParse(aNode.GetProperty("myProperty").Value, out theID))
        {
            myClass.MyProperty = theID;
        }
    }
    

    So, this would set myClass.MyProperty to the Nodes ID. How to do this on a Multi Node Tree Picker Data Type in the same manner?

    Also, do I need to include an additional namespace other than that of umbraco.NodeFactory?

  • Jeavon Leopold 3074 posts 13632 karma points MVP 11x admin c-trib
    Oct 29, 2014 @ 08:24
    Jeavon Leopold
    0

    When rendering with WebForms the recommended method for rendering Umbraco content is a Partial View Macro, then you can use the same snippets here as those using MVC rendering.

    Jeavon

  • Solomon Closson 22 posts 42 karma points
    Oct 29, 2014 @ 14:57
    Solomon Closson
    0

    Is it not possible to get these values within .cs files that are linked to UserControls (.ascx/.ascx.cs files)? Just updated to Umbraco 7.1.2, from version 4.7.1, and not looking to rewrite the entire site if at all possible.

  • Jeavon Leopold 3074 posts 13632 karma points MVP 11x admin c-trib
    Oct 29, 2014 @ 15:19
    Jeavon Leopold
    0

    Yes, have your user control extend Umbraco.Web.UI.Controls.UmbracoUserControl then you will have access to UmbracoHelper in the Umbraco property.

Please Sign in or register to post replies

Write your reply to:

Draft