Cannot set value of FormDropDownList in form?

Posted by Community Admin on 04-Aug-2018 12:01

Cannot set value of FormDropDownList in form?

All Replies

Posted by Community Admin on 20-Jun-2014 00:00

I have a custom FormsControl class that needs to set the value of a drop down field based on a value passed in. In the attachment, the code works fine for text fields, but doesn't work for drop down lists. The value I'm setting exists in the field list. but it's not persisting to the UI. I also am unable to set the index. The outputted <select /> element doesn't set any of its options to selected. 

 What is the proper way to set this field control value? My version is 6.1. Thanks.

Posted by Community Admin on 23-Jun-2014 00:00
Hello Ryan,

There is a blog post related to similar scenario and I believe that it can help you to achieve your goal. Please check the following link for more information:

Sitefinity Custom Form Widget with Dependent Dropdowns

Regards,
Kaloyan
Telerik
 
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
 
Posted by Community Admin on 23-Jun-2014 00:00

Actually this has nothing to do with my question. I'm merely trying to set the value of the drop down list on the server side. No cascading dropdowns, etc. This is a single drop down list, and the value for it can be from any source (in my case, it's from a querystring parameter).

 Thanks.

Posted by Community Admin on 23-Jun-2014 00:00

There has to be a better way than this, but my "hack" was to set the value at the end of the control's pipeline. I imagine something is setting the value AFTER the InitializeControls method is being called, and even in the FormControl's PreRender event (which I tried too, without luck). 

Is there a cleaner way to do this? How I can I pre populate a drop down list?

Posted by Community Admin on 24-Jun-2014 00:00
Hello Ryan,

We have provided an answer in the support ticket that you already opened. You can feel free to share the provided solution with our community.

Regards,
Kaloyan
Telerik
 
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
 
This thread is closed