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.
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.
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?
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!!
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
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
Hi,
You can get the Umbraco DB Connection String via: umbraco.GlobalSettings.DbDSN
Hope this helps,
Tom
Tom,
Thanks for the reply! Found what I needed. Umbraco is great to work with!
is working on a reply...