This is a migrated thread and some comments may be shown as answers.
Changes in Transfer RadListBox not saving after post back
4 Answers 329 Views
This is a migrated thread and some comments may be shown as answers.
Steve Marks
Top achievements
Rank 1
Steve Marks asked on 17 Jul 2009, 05:39 PM
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();
}

 

 

 

 

 

 

 

 

 

4 Answers, 1 is accepted

Sort by
0
Steve Marks
Top achievements
Rank 1
answered on 22 Jul 2009, 01:04 AM
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.
0
Guillaume
Top achievements
Rank 1
answered on 20 Jan 2010, 10:38 AM
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(); 
            } 


0
Genady Sergeev
Telerik team
answered on 22 Jan 2010, 03:29 PM
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.
0
Guillaume
Top achievements
Rank 1
answered on 22 Jan 2010, 03:33 PM
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 !
Asked by
Steve Marks
Top achievements
Rank 1
Answers by
Steve Marks
Top achievements
Rank 1
Guillaume
Top achievements
Rank 1
Genady Sergeev
Telerik team
Share this question
or