Cannot set value of FormDropDownList in form?
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.
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
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).
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?
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.