This is a migrated thread and some comments may be shown as answers.

no selectedvalues when EmptyMessage is set

4 Answers 27 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
jen
Top achievements
Rank 1
jen asked on 30 Mar 2015, 04:38 PM
using version 2014.3.1202

I have the following RadComboBox:

<telerik:RadComboBox runat="server" ID="auto_Section" AutoPostBack="true"
                            AllowCustomText ="false"  Filter="Contains" EmptyMessage="Select Section"
                            DataMember="DisplayString"  DataValueField="ID" DataTextField="DisplayString" 
                            OnSelectedIndexChanged="auto_Section_SelectedIndexChanged" 
                           />
        
When the selected Index changes, the selected value is always returning ""
However, when I remove EmptyMessage="Select Section", it works perfectly.


I tried adding in a default item like so:

<telerik:RadComboBox runat="server" ID="auto_Section" AutoPostBack="true" AppendDataBoundItems="true"
                            AllowCustomText ="false"  Filter="Contains" EmptyMessage="Select Section"
                            DataMember="DisplayString"  DataValueField="ID" DataTextField="DisplayString" 
                            OnSelectedIndexChanged="auto_Section_SelectedIndexChanged" 
                  <Items>
                                <telerik:RadComboBoxItem Text="< Select Section >" Value="-1" />
                  </Items>
</telerik:RadComboBox>

 
 but having AppendDataBoundItems='true' set causes other issues when filtering; the items get appended to the list multiple times.


Does anyone know how to get this to work properly?























4 Answers, 1 is accepted

Sort by
0
jen
Top achievements
Rank 1
answered on 30 Mar 2015, 06:24 PM
I managed to work out the issue in my second scenario. Since the combobox is in the second in a cascade, everytime I was changing the Datasource, it was keeping the previous items as well. So I had to clear the items and re-insert the first item each time.


But back to the first scenario, why is it that setting the emptyMessage stops the selectedValue from coming across when the selected Index changes?








0
Accepted
Nencho
Telerik team
answered on 02 Apr 2015, 08:19 AM
Hello Jen,

As I can see you are using the DataMember to associate the DisplayString field. Could you please remove this setting and test the behavior. In addition, I am sending you the sample project, I have tested with, where you could observe the behavior at my end. Please let us know if it differs in any manner from the implementation at your end.

Note : dll files are removed from the attachment.

Regards,
Nencho
Telerik
 

See What's Next in App Development. Register for TelerikNEXT.

 
0
jen
Top achievements
Rank 1
answered on 02 Apr 2015, 02:53 PM
Thank you! Removing the DataMember setting did the trick!
0
jen
Top achievements
Rank 1
answered on 02 Apr 2015, 02:53 PM
Thank you! Removing the DataMember setting did the trick!
Tags
ComboBox
Asked by
jen
Top achievements
Rank 1
Answers by
jen
Top achievements
Rank 1
Nencho
Telerik team
Share this question
or