Listbox ontransferring not working

4 posts, 0 answers
  1. Roshil
    Roshil avatar
    29 posts
    Member since:
    Jun 2011

    Posted 22 Feb 2012 Link to this post

    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,



  2. Dimitar Terziev
    Admin
    Dimitar Terziev avatar
    1266 posts

    Posted 27 Feb 2012 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Roshil
    Roshil avatar
    29 posts
    Member since:
    Jun 2011

    Posted 07 Mar 2012 Link to this post

    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
  5. Dimitar Terziev
    Admin
    Dimitar Terziev avatar
    1266 posts

    Posted 12 Mar 2012 Link to this post

    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.
Back to Top