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

Listbox ontransferring not working

3 Answers 208 Views
ListBox
This is a migrated thread and some comments may be shown as answers.
Roshil
Top achievements
Rank 1
Roshil asked on 22 Feb 2012, 01:29 PM
Hi,
    Am using two rad list box to transfer items each other mean while database call also

List boxes using : 
<tr>
<td align="left">
   <telerik:RadListBox runat="server" ID="radListAssigned" Height="400px" Width="300px"
    TransferToID="radListUnAssigned" AllowTransfer="true" AutoPostBackOnTransfer="true" TransferMode="Move"
    DataTextField="abc" DataValueField="ID" SelectionMode="Multiple" OnTransferring="radListAssigned_Transferring">
    <Localization AllToLeft="" AllToRight="" />
    <ButtonSettings ShowTransferAll="False" TransferButtons="Common" />
 </telerik:RadListBox>
</td>
<td align="left">
   <telerik:RadListBox runat="server" ID="radListUnAssigned" Height="400px" Width="300px" TransferMode="Move"
    DataTextField="abc" DataValueField="ID" SelectionMode="Multiple">
    <Localization AllToLeft="" AllToRight="" />
    <ButtonSettings TransferButtons="All" />
    </telerik:RadListBox>
 </td>
</tr>

OnTransferring event am updating certain data and the updation is working fine in ontransferring event.
But in the following scenarios transfer not working in both List Boxes,
 1)   if (e.SourceListBox.ID == "radListUnAssigned")   {      
               When transferring, the item selected to transfer is not removing from the SouceListBox (ie, radListUnAssigned) but the
               item is inserted in the Destination  ListBox (ie,radListAssigned ).

  2)  else if (e.SourceListBox.ID == "radListAssigned")  {
        The item selected not inserting to Destinationlistbox (ie, radListUnAssigned) but in
        this case the item is removed from Source list box (ie, radListAssigned)

Here is my code snippet:
       protected void radListAssigned_Transferring(object sender, RadListBoxTransferringEventArgs e)
        {
            if (e.SourceListBox.ID == "radListUnAssigned")
            {                
                int AssignedZipCity = 0;
                int NotAssignZipCity = 0;
                foreach (RadListBoxItem item in e.Items)
                {
                    int isAssigned = -1;
                    isAssigned = < Data updation call >
                    if (isAssigned == 1)
                    {                       
                        AssignedZipCity += 1;
                    }
                    else if (isAssigned == 0)
                    {
                        e.Cancel = true;                      
                        NotAssignZipCity += 1;                 
                    } 
                }
            }
            else if (e.SourceListBox.ID == "radListAssigned")
            {             
                int UnAssignedZipCity = 0;
                int NotUnAssignZipCity = 0;
                foreach (RadListBoxItem item in e.Items)
                {
                    int isUnAssigned = -1;
                    isUnAssigned = <  Data Updation call >
                    if (isUnAssigned == 1)
                    {                       
                        UnAssignedZipCity += 1;
                    }
                    else if (isUnAssigned == 0)
                    {
                        e.Cancel = true;                        
                        NotUnAssignZipCity += 1;
                    }
                }
           }
   Please help me,

  Thanks,



3 Answers, 1 is accepted

Sort by
0
Dimitar Terziev
Telerik team
answered on 27 Feb 2012, 09:02 AM
Hello,

I've made a sample page using your code trying to reproduce the experienced problem, but to no avail. The transferring functionality is working properly on my side. You could find the test page attached.

Could you clarify which is the version of the controls that you are using?

All the best,
Dimitar Terziev
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
Roshil
Top achievements
Rank 1
answered on 07 Mar 2012, 01:34 PM
Hi Dimitar,

    I have gone through your sample page, but to no avail, Stil am looking for your updates.
    In your code, you are udating the datatable on every postback of the page.    
    Am using the version : 2011.3.1122.40
Thanks,
Roshil
0
Dimitar Terziev
Telerik team
answered on 12 Mar 2012, 12:26 PM
Hi,

Could you clarify whether the sample page is working properly on your side? In case it's working based on your expectations try to apply the same approach in your page as well.

All the best,
Dimitar Terziev
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.
Tags
ListBox
Asked by
Roshil
Top achievements
Rank 1
Answers by
Dimitar Terziev
Telerik team
Roshil
Top achievements
Rank 1
Share this question
or