RadListBox Client update

8 posts, 0 answers
  1. Sergio
    Sergio avatar
    9 posts
    Member since:
    Jun 2010

    Posted 27 Sep 2010 Link to this post

    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();
  2. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 30 Sep 2010 Link to this post

    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Sergio
    Sergio avatar
    9 posts
    Member since:
    Jun 2010

    Posted 08 Oct 2010 Link to this post

    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
  5. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 08 Oct 2010 Link to this post

    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
  6. Sergio
    Sergio avatar
    9 posts
    Member since:
    Jun 2010

    Posted 10 Oct 2010 Link to this post

    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

  7. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 13 Oct 2010 Link to this post

    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
  8. Sergio
    Sergio avatar
    9 posts
    Member since:
    Jun 2010

    Posted 13 Oct 2010 Link to this post

    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>
  9. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 15 Oct 2010 Link to this post

    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
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017