no selectedvalues when EmptyMessage is set

5 posts, 1 answers
  1. jen
    jen avatar
    63 posts
    Member since:
    Jun 2009

    Posted 30 Mar 2015 Link to this post

    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?























  2. jen
    jen avatar
    63 posts
    Member since:
    Jun 2009

    Posted 30 Mar 2015 Link to this post

    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?








  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Answer
    Nencho
    Admin
    Nencho avatar
    1458 posts

    Posted 02 Apr 2015 Link to this post

    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.

     
  5. jen
    jen avatar
    63 posts
    Member since:
    Jun 2009

    Posted 02 Apr 2015 in reply to Nencho Link to this post

    Thank you! Removing the DataMember setting did the trick!
  6. jen
    jen avatar
    63 posts
    Member since:
    Jun 2009

    Posted 02 Apr 2015 in reply to Nencho Link to this post

    Thank you! Removing the DataMember setting did the trick!
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017