Portal Engine Questions on portal engine and web parts.
Version 7.x > Portal Engine > Dynamic fields default option View modes: 
User avatar
Certified Developer v7
Certified  Developer v7
Gitesh - 6/19/2013 4:44:53 PM
   
Dynamic fields default option
Hi Guys,

We have got a list of items in our dropdown field in bizform dynamically coming with a sql query.

SQL QUERY
SELECT DocumentID, DocumentName from CMS_Document

We want a default option for our dropdown field called "Please Select".

Is there a way we can add this Please Select option to the dropdown with SQL query items?

Thanks
Gitesh Shah

User avatar
Kentico Support
Kentico Support
kentico_jurajo - 6/20/2013 1:42:25 AM
   
RE:Dynamic fields default option
Hi,

You will need to thave e.g. the first record that is returned to have that value or create a custom form control with drop down list and fill the list with your first item and then append the SQL query results to it.

Best regards,
Juraj Ondrus

User avatar
Kentico Legend
Kentico Legend
Accepted solutionAccepted solution
Brenden Kehren - 6/20/2013 8:53:36 AM
   
RE:Dynamic fields default option
Create a simple SQL query like so:
SELECT -1 AS DocumentID, '-- Please Select --' AS DocumentName
UNION
SELECT DocumentID, DocumentName FROM CMS_Document
ORDER BY DocumentName
I put -- before Please select this way you can set the ORDER BY to the name and still have your "Please Select" option at the top.

User avatar
Certified Developer v7
Certified  Developer v7
Gitesh - 6/20/2013 4:25:05 PM
   
RE:Dynamic fields default option
Hi Guys,

Thanks for your solutions, both the solutions are great but I will go with FroggEye solution as that is exactly what I was looking for and is easy to achieve as well.

Great SQL solution, thanks once again. This is gonna help me alot in my projects.

Cheers
Gitesh Shah