EmptyMessage does not appear when list-box is emptied on the *client*

3 posts, 1 answers
  1. Ed
    Ed avatar
    124 posts
    Member since:
    Jan 2008

    Posted 03 Sep 2013 Link to this post

    Hi everyone,

    Here's my RadListBox:

    <div>
        <telerik:RadListBox id="rlbCountries" runat="server" EnableEmbeddedScripts="false" DataTextField="CountryName" DataValueField="CountryID" EmptyMessage="[No countries selected]" Width="100%" Height="250px" SelectionMode="Multiple"></telerik:RadListBox>
    </div>

    Here's the client-side Javascript code that I use to remove items (countries) after an AJAX call to a web-service:
    var rlbCountries = $find(countriesListBoxID);
    var items = rlbCountries.get_items();
    // clear the current countries
    items.clear();

    I have found that the list box is correctly cleared; however, the "[No countries selected]" message is not displayed.  If I remove the items on the server (via a post-back), the message is shown.

    Has anyone else noticed this?  Is there something I can do to the list-box object on the client in order for the message to be shown?

    Ed Graham
  2. Answer
    Nencho
    Admin
    Nencho avatar
    1457 posts

    Posted 06 Sep 2013 Link to this post

    Hello Ed,

    I was able to replicate the described issue and it is a bug, which I have already forwarded to our developer team. As a workaround, I would suggest you to call the private method _updateEmptyMessageVisibilty(), which would manage the visibility of the EmptyMessage. Please consider the following implementation:
    var rlbCountries = $find("rlbCountries");
               var items = rlbCountries.get_items();
               items.clear();
               rlbCountries._updateEmptyMessageVisibilty();


    Regards,
    Nencho
    Telerik
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Ed
    Ed avatar
    124 posts
    Member since:
    Jan 2008

    Posted 07 Sep 2013 Link to this post

    Excellent, Nencho -- that's fixed it.  Thanks very much.
Back to Top