Changes in Transfer RadListBox not saving after post back

5 posts, 0 answers
  1. Steve Marks
    Steve Marks avatar
    8 posts
    Member since:
    Jul 2009

    Posted 17 Jul 2009 Link to this post

    Hello,

    I have 2 RadListBoxes where items can be transferred between them. One is Source and the other is Selected. Users will move items from the Source ListBox to the Selected ListBox to select items. On PostBack, the items in the Selected ListBox must be saved. Unfortunately, when I check the radListBoxSelected.Items on PostBack, nothing is there to save.

    I started with just setting PersistClientChanges="true" but when that did not work, I added JavaScript handlers to the OnClientTransferring and OnClientTransferred events of the Selected ListBox that set trackChanges() and commitChanges() before and after each transfer. It still does not work. What do I need to do?


    The are ListBoxes are defined as follows:
     

    <rad:RadListBox ID="radListBoxSelected" runat="server" Skin="Vista" Height="120px" AllowTransfer="true" AllowTransferOnDoubleClick="true"  AllowTransferDuplicates="false" ButtonSettings-ShowTransfer="true"  ButtonSettings-ShowTransferAll="true"  ButtonSettings-VerticalAlign="Middle"  EnableDragAndDrop="true"  Sort="Ascending" TransferToID="radListBoxSource" PersistClientChanges="true"  />

     

     

     

    <rad:RadListBox ID="radListBoxSource" runat="server" Skin="Vista" Height="120px" AllowTransferOnDoubleClick="true" AllowTransferDuplicates="false" EnableDragAndDrop="true" PersistClientChanges="true" />

    OnClientTransferring JavaScript 

     

    function RadListBoxSelected_OnClientTransferring(sender, args) {
         var listBox = $find('<control ID>');
         listBox.trackChanges();
    }

    OnClientTransferred  JavaScript

    function RadListBoxSelected_OnClientTransferred(sender, args) {
         var listBox = $find('<control ID>');
         listBox.commitChanges();
    }

     

     

     

     

     

     

     

     

     

  2. Steve Marks
    Steve Marks avatar
    8 posts
    Member since:
    Jul 2009

    Posted 21 Jul 2009 Link to this post

    I figured out what was going on. I was referencing control ClientID's in the page OnInit event. Doing this breaks viewstate and will break the RadListBox among other things. Removing references to control ClientID's in the page OnInit event solved the problem. The RadListBox now works fine.
  3. Guillaume
    Guillaume avatar
    15 posts
    Member since:
    Sep 2006

    Posted 20 Jan 2010 Link to this post

    I have the same problem.

    Here is my source : (it's included in a regular updatepanel)
    <Prometheus:RadListBox PersistClientChanges="true" runat="server" ID="RadListBoxPaySource" DataTextField="libelle"
                          
    DataValueField="modreg" 
                            Height="150px" Width="300px"  AllowReorder="true" EnableDragAndDrop="true"  
                            AllowTransfer="true" TransferToID="RadListBoxPayDestination"/> 
    <Prometheus:RadListBox  PersistClientChanges="true" SelectionMode="Multiple" AllowReorder="true"
                           
    EnableDragAndDrop="true"  
                            runat="server" ID="RadListBoxPayDestination" Height="150px" Width="300px" /> 

    When I first load the page, if the destination is empty (not filled by data):
    - i add from the source (using the button)
    - when validating server side, RadListboxPayDestination.Items.count==0 (whereas I can see it on the page...)
    - after the postback, the destination control is empty
    - if I re-add from the source, it now works correctly.

    I have nothing in OnInit, and in OnLoad, i just have
     if (!Page.IsPostBack) 
                { 
                    
                    RadListBoxPaySource.DataSource = GetMyData()
                    RadListBoxPaySource.DataBind(); 
                } 


  4. Genady Sergeev
    Admin
    Genady Sergeev avatar
    1600 posts

    Posted 22 Jan 2010 Link to this post

    Hi Guillaume JAY,

    I have tried to reproduce the issues that you experience on a sample project, however, as far as I can see, there are no problems at all. Which version of the RadControls do you use? I am attaching my sample to this replay, can you reproduce the problem on it?

    Sincerely yours,
    Genady Sergeev
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  5. Guillaume
    Guillaume avatar
    15 posts
    Member since:
    Sep 2006

    Posted 22 Jan 2010 Link to this post

    I forgot to update my post.

    My problem was in fact that I was enabling/disabling the radlistbox from the client side.

    I changed that so I hide then now, and It's working.

    Thank for your support anyway !
Back to Top