+1-888-365-2779
Try Now
More in this section

Forums / Bugs & Issues / Cannot set value of FormDropDownList in form?

Cannot set value of FormDropDownList in form?

5 posts, 0 answered
  1. Ryan
    Ryan avatar
    57 posts
    Registered:
    07 May 2013
    20 Jun 2014
    Link to this post

    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.

  2. Kaloyan
    Kaloyan avatar
    272 posts
    Registered:
    02 Dec 2016
    23 Jun 2014
    Link to this post
    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
     
  3. Ryan
    Ryan avatar
    57 posts
    Registered:
    07 May 2013
    23 Jun 2014 in reply to Kaloyan
    Link to this post

    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.

  4. Ryan
    Ryan avatar
    57 posts
    Registered:
    07 May 2013
    23 Jun 2014
    Link to this post

    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?

  5. Kaloyan
    Kaloyan avatar
    272 posts
    Registered:
    02 Dec 2016
    24 Jun 2014
    Link to this post
    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
     
5 posts, 0 answered