We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Drag and Drop get items on server side

Hi

I have created 3 listboxes, 2 on the left, one on the right. The right one is filled with roles from the database, I enabled drag and drop on all the listboxes and that works. But on save I need to retrieve all the items that was dropped into the left 2 listboxes. 

I used listboxread.items, but it does not contains the items.

Here is the code:

                                        <div class="row">
                                            <div class="col-xs-6">
                                                <asp:Label runat="server" AssociatedControlID="listboxRead" CssClass="control-label">Read Permission</asp:Label>
                                                <ej:ListBox ID="listboxRead" runat="server" AllowDragAndDrop="true" ShowRoundedCorner="True" DataSourceCachingMode="ViewState">
                                                    <Items>
                                                        <ej:ListBoxItems Text=""></ej:ListBoxItems>
                                                    </Items>
                                                </ej:ListBox>

                                                <asp:Label runat="server" AssociatedControlID="listboxWrite" CssClass="control-label">Write Permission</asp:Label>
                                                <ej:ListBox ID="listboxWrite" runat="server" AllowDragAndDrop="true"  ShowRoundedCorner="True" >
                                                    <Items>
                                                        <ej:ListBoxItems Text=""></ej:ListBoxItems>
                                                    </Items>
                                                </ej:ListBox>
                                            </div>
                                            <div class="col-xs-6">
                                                <asp:Label runat="server" AssociatedControlID="listboxRoles" CssClass="control-label">Available Roles</asp:Label>
                                                <ej:ListBox ID="listboxRoles" runat="server" AllowDragAndDrop="true"  ShowRoundedCorner="True" ></ej:ListBox>
                                               
                                            </div>
                                        </div>

and on server side:

List<string> newreadlist = new List<string>();

            foreach (var item in listboxRead.Items)
            {
                newreadlist.Add(item.Value);
            }

            var readlist = String.Join(",", newreadlist);

            List<string> newwritelist = new List<string>();

            foreach (var item in listboxWrite.Items)
            {
                newwritelist.Add(item.Value);
            }
            var writelist = String.Join(",", newwritelist);


1 Reply

SS Selvamani Sankarappan Syncfusion Team May 9, 2017 10:41 AM UTC

Hi Armand, 
 
Thanks for contacting Syncfusion support. 
 
We have checked your code example. You need to get the dropped items at server side using server side events. But, currently we haven’t provided any server side events for item drop. So, we have considered this as a defect. A support incident to track the status of this defect has been created under your account. Please log on to our support website to check for further updates. 
 
Regards, 
 
Selvamani S. 


Loader.
Up arrow icon