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);