Multiselection for Custom Table entries

Stefan Sturm asked on September 20, 2018 12:33

Hello

I am searching for a way to have a page type field that allows the CMS user to select multiple items (via dropdown) stored in a custom table.

So far i tried the "Uni Selector" but struggled to get this thing work. I allways get the error msg "System.Exception: Object type 'xxx.classnameofthetable' not found"

Is there a nother/better way to achieve the requirements or can you give me a hint what i did wrong so far with the "Uni Selector".

Setup: Kentico 8.1.2

Kind regards

Stefan

Recent Answers


Dragoljub Ilic answered on September 20, 2018 13:20 (last edited on September 20, 2018 14:53)

Hi Stefan,

You get that error message because name of the custom table is not really an object in Kentico. Object will be 'cms.customtable', and custom table will be only an item of those object. I don't have experience with that version of Kentico, but I guess that you can use List box control. If you use list box, you can configure it to use either Macro or SQL query. Because it's custom table data, I will suggest you to go with SQL query, something like this:

SELECT ColumnValueName, ColumnTextName FROM xxx.classnameofthetable

and then use this column names for Item transformation and Value column like macros, f.e.: {% ColumnValueName %}

Like I mentioned, I don't have experience with 8.1 version, but should give you some point to start. Hope this will help.

Best regards, Dragoljub

1 votesVote for this answer Mark as a Correct answer

Peter Mogilnitski answered on September 20, 2018 15:16 (last edited on September 20, 2018 15:19)

You could use Multiple choice control and wrap it with a div, i.e. put in HTML Envelope Content before and after <div style="width: 300px; height:140px; overflow:auto !important; border 2px solid grey;">" and "</div>. If really want to use a drop down, you need to clone existing form control CMS\CMSFormControls\Basic\DropDownListControl.ascx and change selectionmode to multiple.

1 votesVote for this answer Mark as a Correct answer

Stefan Sturm answered on September 21, 2018 17:02

Thank you both!

I will give it a try and respond later.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.