Data Bindings Not Displaying For DropDownList

3 posts, 0 answers
  1. Derek
    Derek avatar
    2 posts
    Member since:
    Jun 2019

    Posted 20 Jun 2019 Link to this post

    I have a dropdownList that has the following:

    DataSource: binds to a table with 2 columns (ID, Style)

    DisplayMember: Is Set to "Style"

    ValueMember: Is Set to "Style"

     

    I have a binding source which binds to an model. One of its properties, "PartitionStyle" is a string value.

    I set the dropdownList DataBinding.Text: BindingSource.PartitionStyle (Note, I did also try DataBinding.SelectedValue as well)

    Now when I choose a value from the drop down list, the "PartitionStyle" property updates to that value which is great. So I save that model and close the form down. Now when I relaunch the form passing in that model to the bindingsource, the display or text of that dropdownlist does not have the correct value(has the index 0 value selected).

    I've tried setting BindingSource.DataSource to that model, then BindingSource.ResetBindings, it doesn't work. All the rest of the controls that are NOT dropdownList are displaying correctly(textboxes have the correct values from the properties they are binded to, checkboxes as well).

    Any help?

  2. Derek
    Derek avatar
    2 posts
    Member since:
    Jun 2019

    Posted 21 Jun 2019 Link to this post

    Nevermind, I was able to fix it. I was calling the BindingSource.ResetBindings a little earlier than when the event went off when loading the form.
  3. Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    3952 posts

    Posted 25 Jun 2019 Link to this post

    Hello, Derek,  

    I am glad that you have found a suitable solution for your scenario.

    Note that if you are experiencing any further difficulties, it would be greatly appreciated if you can submit a support ticket from your account and provide a sample project demonstrating the undesired behavior. Thus, our support engineers will gladly assist you.

    I would recommend you to have a look at the following tutorial demonstrating how the simple data binding works: https://www.codeproject.com/Articles/11530/Understanding-Simple-Data-Binding

    I hope this information helps.

    Regards,
    Dess | Tech Support Engineer, Sr.
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top