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

Values not shown when transferring between two databound listboxes using templates

5 Answers 65 Views
ListBox
This is a migrated thread and some comments may be shown as answers.
Frank Flood
Top achievements
Rank 1
Frank Flood asked on 24 Jun 2011, 06:52 PM
I currently have to listbox that both use the same template.  Instead of using a list of values like the demo code, I am pre-populating both boxes with some initial data.  When I transfer an item from one box to the other, the values are not updated.

When using the item list in the html, the item bind on the '_Transferred' method appeared to update these values using the same templates.

The problem is when I switched it to use the list from the database instead of the HTML list.

How can I get the data to show (bind) when transferring in this manner.

Thanks.

5 Answers, 1 is accepted

Sort by
0
Genady Sergeev
Telerik team
answered on 29 Jun 2011, 08:33 AM
Hi Frank,

RadListBox cannot transfer templated items on the client, this should be done on the server. Please make sure that you have set the AllowTransferOnPostackProperty on RadListBox to true.

Kind regards,
Genady Sergeev
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

0
Frank Flood
Top achievements
Rank 1
answered on 01 Jul 2011, 04:46 PM
We actually think we found a workaround for it.  We noticed it worked if using the list items in the html.  So in the code-behind, instead of just binding the data, we actually created new DataItems and added them to each control.  Once we did that, it worked exactly how we wanted.  We could populate each one independently, use the template column and also not lose the info when moving them on the client UI.

Maybe that solution will help someone else with a similar issue.
0
Alok
Top achievements
Rank 1
answered on 09 Aug 2011, 07:36 AM
Can you please tell me in detail how i write this code actually i have also the same problem a have multiple column in listbox so i use itemtemplates but when i move one row or multiple row it clear the row from source but not update in destination list box
0
Alok
Top achievements
Rank 1
answered on 09 Aug 2011, 07:40 AM
It works but the data not updated to destination listbox also it can not move one row please tell me how can i transfer between two databound listbox templates.


0
Frank Flood
Top achievements
Rank 1
answered on 09 Aug 2011, 08:39 PM
In the CodeBehind, when we build the page initially, we retrieved the data into a dataset.  We then iterated through the dataset and added the appropriate item to each control.

first we bound to one control and then while binding the second, we checked if it was in the first control before adding.
Example in our for loop:

RadListBoxItem newListItem = new RadListBoxItem(singleOverlay["Name"].ToString(), singleOverlay["ID"].ToString());

newListItem.Attributes.Add(

"AdditionalField", singleOverlay["AdditionalField"].ToString());

if
(!rlbEventOverlays.Items.Contains(rlbEventOverlays.FindItemByValue(singleOverlay["ID"].ToString())))

 

         rlbSourceOverlays.Items.Add(newListItem);



We have this code in the '_Transferred' event for both controls:

foreach (RadListBoxItem item in e.Items)

{

     item.DataBind();

}


In the HTML, we have AllowReOrder, AllowTransfer, AutoPostbackOnReorder, AutoPostbackOnTransfer, EnableDragAndDrop set to true on the 'source' control and have the TransferToID set to the other control.

On the other control, we just have the AllowReOrder,  AutoPostbackOnReorder, EnableDragAndDrop set to true.

Hopefully that will help you out.

Tags
ListBox
Asked by
Frank Flood
Top achievements
Rank 1
Answers by
Genady Sergeev
Telerik team
Frank Flood
Top achievements
Rank 1
Alok
Top achievements
Rank 1
Share this question
or