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

AllowTransferOnDoubleClick=true does not generate postback

4 Answers 89 Views
ListBox
This is a migrated thread and some comments may be shown as answers.
July
Top achievements
Rank 2
July asked on 13 Jun 2012, 12:45 PM
this is my aspx code

 <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" Height="100%" Width="100%" LoadingPanelID="LoadCombo" >
                            <div class="leftContainerIn">
                                <telerik:RadListBox ID="rlbAvailable" runat="server" Width="100%" AllowTransfer="true"
                                   TransferToID="rlbChosen" SelectionMode="Multiple"
                                  AllowTransferOnDoubleClick="true"
                                    


                                    Height="100%" EnableDragAndDrop="true" DataValueField="FieldId" DataTextField="tempHeader"
                                    Sort="Ascending" OnClientTransferring="rlbAvailable_OnClientTransferring" AutoPostBackOnTransfer="true"
                                    OnTransferred="rlbAvailable_OnTransferred" ButtonSettings-ShowTransferAll="true">
                                </telerik:RadListBox>
                            </div>
                            <div class="rightContainerIn">
                                <telerik:RadListBox ID="rlbChosen" runat="server" Sort="Ascending" Width="100%" Height="100%"
                                    AutoPostBack="true" OnSelectedIndexChanged="rlbChosen_SelectedIndexChange" SelectionMode="Multiple"
                                    EnableDragAndDrop="true"  AllowTransferOnDoubleClick="false"
                                    AllowReorder="true" DataTextField="tempHeader" DataValueField="FieldId" TransferToID="rlbAvailable">
                                </telerik:RadListBox>
                            </div>
                        </telerik:RadAjaxPanel>

this is my cs code

 protected void rlbAvailable_OnTransferred(object sender, RadListBoxTransferredEventArgs e)
        {
            try
            {


                List<smDocumentTypeField> avalible = FieldsOrganization;
                List<smDocumentTypeField> documentTypeFields = DocumentTypeField;


                if (e.DestinationListBox != sender) // from left to right
                {
                    foreach (RadListBoxItem ite in e.Items)
                    {
                        int id = Convert.ToInt32(ite.Value);
                        documentTypeFields.Insert(0, GetField(FieldsOrganization, id));
                        avalible.Remove(GetField(FieldsOrganization, id));


                    }


                   
                }
                else if (e.DestinationListBox == sender)// from right to left
                {
                    foreach (RadListBoxItem ite in e.Items)
                    {
                        int id = Convert.ToInt32(ite.Value);


                        avalible.Insert(0, GetField(DocumentTypeField, id));
                        documentTypeFields.Remove(GetField(DocumentTypeField, id));
                    }
                }


               FieldsOrganization = avalible;
                DocumentTypeField = documentTypeFields;
                rlbChosen.DataBind();
                rlbAvailable.DataBind();
            }
            catch (Exception ex)
            {
                Notification.LoadCatchNotification(ex, typeof (DocumentTypeForm).FullName);
            }
        }


this event does not execute when i did double click on radlistboxitem, Why?

I need help!!


regards

4 Answers, 1 is accepted

Sort by
0
Accepted
Bozhidar
Telerik team
answered on 18 Jun 2012, 06:57 AM
Hello Julieta,

You have to remove the TransferToID attribute from the second ListBox. This attribute only has to be set on the first ListBox.
 
All the best,
Bozhidar
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
July
Top achievements
Rank 2
answered on 18 Jun 2012, 11:58 AM
Thanks! Taht's works!!!
0
Accepted
Craig
Top achievements
Rank 1
answered on 05 Sep 2012, 06:09 AM
Removing the TransferToID doesn't fix the problem for me as I need the ability to transfer to/from both my ListBox's i.e. lb1 to lb2 and lb2 to lb1

Why don't you raise the Transferred event on DoubleClick?  Havng to use OnClientTransferred is a real pain as I now need to hack code to get the same functionality of my Transferred event.
0
Bozhidar
Telerik team
answered on 10 Sep 2012, 06:18 AM
Hello Jeff,

When you have two RadListBoxes on the page and you want to allow the transfer of items between them, you only need to set the TransferToID property of the first ListBox. Please refer to the following demo to see a working example of this:
http://demos.telerik.com/aspnet-ajax/listbox/examples/functionality/transfer/defaultcs.aspx 

As you can see in the demo, although the property is set only on the first ListBox, you can transfer items in both directions.

As for the second part of your question, in order for the Transferred server event to be fired, you have to set the AutoPostBackOnTransfer property to true.
 
Regards,
Bozhidar
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
July
Top achievements
Rank 2
Answers by
Bozhidar
Telerik team
July
Top achievements
Rank 2
Craig
Top achievements
Rank 1
Share this question
or