Copied to clipboard

Flag this post as spam?

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


  • Ivan 165 posts 543 karma points
    Feb 27, 2014 @ 10:10
    Ivan
    0

    Adding uComponents DataType to usercontrol

    Hi.

    How do I add uComponents DataType (e.g. UrlPicker) to my .ascx usercontrol?

    This approach looks weird: http://our.umbraco.org/wiki/reference/code-snippets/use-mntp-on-a-usercontrol

    Can't I just use something like: <umb:UrlPicker id=picker" runat="server" />

  • Lee Kelleher 4020 posts 15802 karma points MVP 13x admin c-trib
    Feb 27, 2014 @ 10:31
    Lee Kelleher
    1

    Hi Ivan,

    It's been a long time since I tried that approach. The wiki page should still have the correct instructions.

    The key part to keep in mind is that these data-types aren't typical .NET controls, many of them have prevalue config/settings, which need to be populated ... and some require a context of a content nodeId.

    We do have an undocumented control called "EditProperty" - but is largely untested - as in I developed it for a client project, it worked for them, so I bundled it with uComponents for future use (and didn't develop it further).

    <%@ Register Assembly="uComponents.Controls" Namespace="uComponents.Controls" TagPrefix="uComponents" %>
    <uComponents:EditProperty runat="server" ID="myEditProperty" Alias="myUrlPickerAlias" NodeId="1066" />
    

    This would then attempted to get the content node (for the specified NodeId) and property field (with the alias myUrlPickerAlias) and render the edit control for that.

    Then in the code-behind there is a method myEditProperty.Save() that would attempt to update the node's property value.

    Feel free to give it a go... I can't say that it's going to work, but it's worth a try. The source-code for it is here: https://github.com/uComponents/uComponents/blob/master/src/uComponents.Controls/EditProperty.cs

    Cheers,
    - Lee

  • Ivan 165 posts 543 karma points
    Feb 27, 2014 @ 12:02
    Ivan
    0

    Hi Lee.

    Thanks for sharing this new control. I'll give it a try.

Please Sign in or register to post replies

Write your reply to:

Draft