Copied to clipboard

Flag this post as spam?

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


  • domm123 6 posts 26 karma points
    Jan 31, 2013 @ 06:43
    domm123
    0

    Datagrid with Urlpicker

    Hi,

    I have tried to place the UrlPicker datatype in to the uComponent Datagrid.

    But when I try to edit a datagrid row record. The content in the UrlPicker show up empty.

    Can i know, how do I retain the data on it?

     

    Thanks

  • SC Digital Services Team 104 posts 171 karma points
    Feb 12, 2013 @ 15:44
    SC Digital Services Team
    0

    Hello

    We have noticed that using the combination of Umbraco 4.11.4 and uComponents 5.3.2, adding a UrlPicker to a Datagrid is not possible - it is not listed in the dropdown list of available Datatypes.

    What combination are you using?

  • Francisco 21 posts 72 karma points
    Feb 26, 2013 @ 02:46
    Francisco
    0

    Hi,

    I am using Umbraco v4.11.4 with uComponents v5.4.

    I have a Datagrid with a url-picker and a textstring (description)

    I followed the documentation: http://ucomponents.org/data-types/datatype-grid/razor-samples/ to retrieve the values using razor without success.

    My code:

                            @foreach (var subItem in item.MainPageNavigationLinks)

                            {

                                var link = subItem.Link.urlpicker;

                                <li>

                                    <a href="/">

                                        <h4>@link.Url</h4>

                                        <p>@subItem.Description</p>

                                    </a>

                                </li>

                            }

    The @subItem.Link has this content inside:

    <url-picker mode="Content">

      <new-window>False</new-window>

      <node-id>4447</node-id>

      <url>http://website.slsnz.localhost/sports/about-us/</url>;

      <link-title>About</link-title>

    </url-picker>

    I can get @subItem.Description, but subItem.Link.urlpicker is not working, because @subItem.Link is a GridCell and it does not have a definition for urlpicker as shown in the log:
    -----------------------
    2013-02-26 14:57:29,103 [27] WARN  umbraco.macro - [Thread 20] Error loading MacroEngine script (file: SLSHomePageHeaderNavigation.cshtml, Type: ''. Exception: Microsoft.CSharp.RuntimeBinder.RuntimeBinderException: 'uComponents.DataTypes.DataTypeGrid.Model.GridCell' does not contain a definition for 'urlpicker'
    -----------------------

     Anyone knows how to access the urlpicker inside a datatype grid?

    Cheers,

     

  • Francisco 21 posts 72 karma points
    Feb 26, 2013 @ 03:55
    Francisco
    0

    I found a solution, but I'm not sure is the best one:

     

                            @foreach (var subItem in item.MainPageNavigationLinks)

                            {

                                var link = UrlPickerState.Deserialize(subItem.Link.ToString());

                                <li>

                                    <a href="@link.Url">

                                        <h4>@link.Title</h4>

                                        <p>@subItem.Description</p>

                                    </a>

                                </li>

                            }

  • Ove Andersen 435 posts 1541 karma points c-trib
    Mar 15, 2013 @ 12:07
    Ove Andersen
    0

    You can use the AsDynamicXml() method on the GridCell object to iterate over the data more easily.

Please Sign in or register to post replies

Write your reply to:

Draft