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

Problem with Transfer to multiple RadListBoxes using Drag and Drop

5 Answers 130 Views
ListBox
This is a migrated thread and some comments may be shown as answers.
Anil
Top achievements
Rank 1
Anil asked on 26 Sep 2011, 11:34 AM
Hi,
I am using "Transfer to multiple RadListBoxes using Drag and Drop" feature. I got a jQuery function from Telerik team for this.

After implementing this i am not able to get the transfered listbox item either in client side or in serverside.

How can i get the selected/checked items from any of the listboxes?

5 Answers, 1 is accepted

Sort by
0
Peter Filipov
Telerik team
answered on 29 Sep 2011, 01:25 PM
Hi Anil,

Could you please provide me a sample project that reproduces your issue? Also clarify which version of our controls you are using.

I tested the following project with the latest version of our controls and everything works fine on my side.

All the best,
Peter Filipov
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0
Ammar
Top achievements
Rank 1
answered on 21 Oct 2011, 05:39 PM
The values of the RadListBox items can't be accessed from server side.
Do you have a suggestion for that?
0
Peter Filipov
Telerik team
answered on 25 Oct 2011, 06:11 PM
Hello Ammar,

To access the transferred items you need the mark them into the client state of the RadListBoxes as transferred. Please review the following help article for more info.

Kind regards,
Peter Filipov
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0
Ammar
Top achievements
Rank 1
answered on 25 Oct 2011, 06:50 PM
thanks Peter i ended up solving that from the client side with hidden fields here is the client side script that i used:

function getlistboxesvalues() {  

//to do get the value of the items  

 

var arr1 = new String();   

var arr2 = new String();

var arr3 = new String();

 var arrR1 = $find('<%= RadListBox3.ClientID %>');

 var arrR2 = $find('<%= RadListBox4.ClientID %>');

var arrR3 = $find('<%= RadListBox5.ClientID %>');

 
var arrR1Items = arrR1.get_items();

var arrR2Items = arrR2.get_items();

var arrR3Items = arrR3.get_items();

 

var ar1 = document.getElementById('hdnField1');

var ar2 = document.getElementById('hdnField2');

var ar3 = document.getElementById('hdnField3');

 

 for (var i = 0; i < arrR1Items.get_count(); i++)

 {

      if (arrR1Items.getItem(i)._text != "")

      {

        arr1 += arrR1Items.getItem(i)._text;

     if (arrR1Items.get_count() > i+1)

     {

          arr1 += '|';

     }

 }

 for (var i = 0; i < arrR2Items.get_count(); i++)

 {

         if (arrR2Items.getItem(i)._text != ""
        {

            arr2 += arrR2Items.getItem(i)._text ;

         }

 

    if (arrR2Items.get_count() > i +1)

         {

            arr2 +='|'
        }

  }

 

 

 

for (var i = 0; i < arrR3Items.get_count(); i++)

 

{

         if (arrR3Items.getItem(i)._text != "")

        {

            arr3 += arrR3Items.getItem(i)._text ;

        } 

 

    if (arrR3Items.get_count() > i +1)

         {

            arr3 += '|';

          }

}

 

ar1.value = arr1;

ar2.value = arr2;

ar3.value = arr3;

 

}

when the onClientClick event fires up you I’ll have all the values of the RadListBoxes in the hidden field ar1, ar2, ar3 and I can after that do whatever need to be done on the server side i know that this script could be optimized and I’m sure I’ll give it a try in the other way you mentioned.
Thanks again.

 

0
Rakesh
Top achievements
Rank 1
answered on 08 Dec 2011, 05:40 AM
I had the same problem,
so when u add or remove the item from rad list box ,
use track change function of rad list box  before inserting or removing then immediately after that use commit changes.
Following is the example for the same which worked for me  : -
Ex :- 
  -----> For Removing
             function remove(list) {                                      
                    var items1 = list.get_items();
                    var item1 = list.get_selectedItem();
                    list.trackChanges();
                    items1.remove(item1);
                    list.commitChanges();
                }

    ------> For Adding
                  function remove(list) {  
                       destination.trackChanges();
                       destination.get_items().insert(reorderIndex, item);
                       destination.commitChanges();
                      }

Best Luck
Tags
ListBox
Asked by
Anil
Top achievements
Rank 1
Answers by
Peter Filipov
Telerik team
Ammar
Top achievements
Rank 1
Rakesh
Top achievements
Rank 1
Share this question
or