SelectedText duplicates in RadDropDownList

1 Answer 22 Views
DropDownList
Kobus
Top achievements
Rank 1
Iron
Kobus asked on 19 May 2022, 03:53 AM

Hello.

I build a Combo from a table

                DataTable dt = lb.clsDB_user_store_gen.get_dt_for_all_user_store();
                cboReporter.DataSource = dt;
                cboReporter.ValueMember = "uid";
                cboReporter.DisplayMember = "displayName";

I put the form in ADD MODE, and wand to say in the first record "Select a Reporter" 

It works the first time. When I update the record and clear the form, I call the code below. this then add the text again. (sorry wanted to add small video, but mp4 not supported)

                // cboReporter
                cboReporter.SelectedText = "";
                cboReporter.SelectedText = "Select a Reporter";
                // cboAssignee
                cboAssignee.SelectedText = "";
                cboAssignee.SelectedText = "Select a Assignee";

1 Answer, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 20 May 2022, 01:42 PM
Hello, Kobus,   

According to the provided code snippet, it is not clear what are the exact records available in RadDropDownList. However, if you have the first record that holds the text "Select a Reporter", instead of setting the SelectedText property, simply set the SelectedIndex to 0 and thus the first item's text will be displayed. Alternatively, if you don't have a specific record that holds "Select a Reporter", it is suitable to use the embedded label functionality:
https://docs.telerik.com/devtools/winforms/knowledge-base/drop-down-list-embedded-label 

In case you are still experiencing any further difficulties, it would be greatly appreciated if you can provide a complete code snippet that replicates the undesired behavior if we copy/paste the code in a brand new project. Thus, we would be able to provide further assistance. Thank you in advance.

I hope this information helps. If you need any further assistance please don't hesitate to contact me. 

Regards,
Dess | Tech Support Engineer, Principal
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
DropDownList
Asked by
Kobus
Top achievements
Rank 1
Iron
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or