Values not shown when transferring between two databound listboxes using templates

6 posts, 0 answers
  1. Frank Flood
    Frank Flood avatar
    33 posts
    Member since:
    Jun 2004

    Posted 24 Jun 2011 Link to this post

    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.
  2. Genady Sergeev
    Admin
    Genady Sergeev avatar
    1596 posts

    Posted 29 Jun 2011 Link to this post

    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.

  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Frank Flood
    Frank Flood avatar
    33 posts
    Member since:
    Jun 2004

    Posted 01 Jul 2011 Link to this post

    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.
  5. Alok
    Alok avatar
    8 posts
    Member since:
    Apr 2011

    Posted 09 Aug 2011 Link to this post

    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
  6. Alok
    Alok avatar
    8 posts
    Member since:
    Apr 2011

    Posted 09 Aug 2011 Link to this post

    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.


  7. Frank Flood
    Frank Flood avatar
    33 posts
    Member since:
    Jun 2004

    Posted 09 Aug 2011 Link to this post

    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.

Back to Top
UI for ASP.NET Ajax is Ready for VS 2017