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

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

2 Answers 25 Views
ListBox
This is a migrated thread and some comments may be shown as answers.
Ed
Top achievements
Rank 1
Ed asked on 03 Sep 2013, 02:32 PM
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 Answers, 1 is accepted

Sort by
0
Accepted
Nencho
Telerik team
answered on 06 Sep 2013, 08:56 AM
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.
0
Ed
Top achievements
Rank 1
answered on 07 Sep 2013, 09:43 AM
Excellent, Nencho -- that's fixed it.  Thanks very much.
Tags
ListBox
Asked by
Ed
Top achievements
Rank 1
Answers by
Nencho
Telerik team
Ed
Top achievements
Rank 1
Share this question
or