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

RadListBox Client update

7 Answers 141 Views
ListBox
This is a migrated thread and some comments may be shown as answers.
Sergio
Top achievements
Rank 1
Sergio asked on 27 Sep 2010, 07:10 AM
Hello everyone,
I am currently using the latest version of the telerik library.
The problem is that I have a RadListBox and I add items to it using the client side API.
It is not working properly as it is not refreshing the UI. But it is adding the items on the background, I know this because when I get the items the added one is in the list.
I have seen old posts about this and says to update to the latest to fix it, but that is not my case :S

Thanks in advance,

Sergio Martinez

Here is the code I'm using:

    varPreferencesScheduleList.trackChanges();// this is my list
            
            var item = new Telerik.Web.UI.RadListBoxItem();
            item.set_text(newText);            
            varPreferencesScheduleList.get_items().add(item);
            
            varPreferencesScheduleList.commitChanges();

7 Answers, 1 is accepted

Sort by
0
Yana
Telerik team
answered on 30 Sep 2010, 08:04 AM
Hi Sergio,

We've tried to reproduce this issue but to no avail. Can you reproduce it in our online demo here?
Please send us more details about the problem, thanks in advance.

Kind regards,
Yana
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Sergio
Top achievements
Rank 1
answered on 08 Oct 2010, 05:55 AM
Hello Yana,
The demo works fine...

What other info can be relevant for you, it is a really simple case :S....

Thanks in advance,

Sergio Martinez
0
Yana
Telerik team
answered on 08 Oct 2010, 01:09 PM
Hello Sergio,

Which version of the controls exactly you're using? Can you send us a simple code demonstrating the problem (you can paste it with the Format Code Block)?

Greetings,
Yana
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Sergio
Top achievements
Rank 1
answered on 10 Oct 2010, 11:13 PM
Hi Yana,
The version I'm using is Telerik.Web.UI_2010_2_826. and the this is the code snippet.

var newText = "";
if ($("#datPreferencesScheduleDayMonday").attr('checked'))
{ newText = newText + "Monday," }
if ($("#datPreferencesScheduleDayTuesday").attr('checked'))
{ newText = newText + "Tuesday," }
if ($("#datPreferencesScheduleDayWednesday").attr('checked'))
{ newText = newText + "Wednesday," }
if ($("#datPreferencesScheduleDayThursday").attr('checked'))
{ newText = newText + "Thursday," }
if ($("#datPreferencesScheduleDayFriday").attr('checked'))
{ newText = newText + "Friday," }
if ($("#datPreferencesScheduleDaySaturday").attr('checked'))
{ newText = newText + "Saturday," }
if ($("#datPreferencesScheduleDaySunday").attr('checked'))
{ newText = newText + "Sunday," }
             
newText = newText.substring(0, newText.length - 1) + " - " + time;
 
varPreferencesScheduleList.trackChanges();
             
var item = new Telerik.Web.UI.RadListBoxItem();
item.set_text(newText);           
varPreferencesScheduleList.get_items().add(item);
             
varPreferencesScheduleList.commitChanges();

Hope this helps.

Thanks in advance,

Sergio Martinez

0
Yana
Telerik team
answered on 13 Oct 2010, 04:53 PM
Hello Sergio,

I've attached a short movie and my test page to show you that this code works as expected at our side - I've tested it in IE8, Firefox and Chrome.

Sincerely yours,
Yana
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Sergio
Top achievements
Rank 1
answered on 13 Oct 2010, 11:40 PM
Hello Yana,

Thanks for the video and sample, but my code clearly reflects the same, it is very strange since the delete case does work. :S
I also noticed that we are using templates, I guess this also add some complexity?

Here is my radlistbox declaration

<telerik:RadListBox ID="datPreferenceSchedule" runat="server" Style="width: 330px"
    Height="150px">
    <ItemTemplate>
    <%# Eval("CombinedDays") %>
        -
    <%# Convert.ToDateTime(DataBinder.Eval(Container.DataItem, "Time")).ToShortTimeString() %>
    </ItemTemplate>
</telerik:RadListBox>
0
Yana
Telerik team
answered on 15 Oct 2010, 03:08 PM
Hi Sergio,

When items are added on the client, they cannot use the template - that's why the UI is not updated in your page -  actually the added item is empty.

You should add items on the server only when using templates.

Kind regards,
Yana
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
ListBox
Asked by
Sergio
Top achievements
Rank 1
Answers by
Yana
Telerik team
Sergio
Top achievements
Rank 1
Share this question
or