Copied to clipboard

Flag this post as spam?

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


  • Accusoft 58 posts 109 karma points
    Apr 19, 2011 @ 14:13
    Accusoft
    0

    Adding a new custom data type

    I apologize if this is the wrong forum to post this in - I'm new to umbraco and trying to get my feet wet.  I'm trying to create a new document type for knowledgebase articles.  I have another document type for products.  I want to create a custom selector so that when you're adding a knowledgebase article, you can select which products it applies to.  From the research I've done I think adding a custom data type is the best way to accomplish this.  Are there any tutorials or samples on how to build this?  I'm familiar with ASP.NET and am confident I can code it accordingly, just need to know how to interface with Umbraco really.

    I don't want to use a drop down because the products list could get very long.  I was thinking they could click a link and it would load a lightbox popup with a paged list of all products.  The field itself would show the products with an "X" next to them so if they wanted to remove the association they could just click that.  

    Any insight would be tremendously appreciated!!

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Apr 19, 2011 @ 14:27
    Tom Fulton
    0

    Hi Chris,

    There are some great tutorials on custom datatypes on Tim's blog.  If you are using 4.7+ the easiest way to get started is probably using the UserControlWrapper method, see Creating custom umbraco datatypes revisited again.  That article also has links to the older method (abstract data editor).  There's also some good articles on using the new DataEditorSettings and a video that may help.

    That being said, you might also be able to use an existing datatype, MultiNodeTreePicker from uComponents to relate your articles to products.

    -Tom

  • Accusoft 58 posts 109 karma points
    Apr 20, 2011 @ 16:51
    Accusoft
    0

    Hi Tom,

    Thanks for the feedback.  I've read through Tim's blog posts and they're a great starting point.  I'm trying to build something more complex based on his framework and am running into what I think is a simple thing to fix.  I have to query the DB directly from the custom control.  Since there is no web.config with a connection string in the custom control itself, how do I tell it to use Umbraco's connection string to perform the query and loop through the results?

    Thanks!

    Chris

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Apr 20, 2011 @ 17:03
    Tom Fulton
    0

    Hi,

    You can get the Umbraco DB Connection String via:  umbraco.GlobalSettings.DbDSN

    Hope this helps,
    Tom

  • Accusoft 58 posts 109 karma points
    Apr 20, 2011 @ 21:58
    Accusoft
    0

    Tom,

    Thanks for the reply!  Found what I needed.  Umbraco is great to work with!

Please Sign in or register to post replies

Write your reply to:

Draft