How to fetch the listbox records in server side in c#

2 posts, 0 answers
  1. Raj
    Raj avatar
    33 posts
    Member since:
    Jan 2012

    Posted 08 Mar Link to this post

    hi all,

     

    my scenario:

    i have three listbox, EmployeeName as Parent List Box, ProjectAdmin and ProjectReader as Child List box. i will drag and drop from parent list to its child list box. the drag and drop concept is working fine for me(i doing this in client side using Javascript). while i am inserting the details in database in c#, the Child list box shows empty. i cannot fetch the items in c# server, where the drag and drop done in javascript.

    HTML Code

    <table class="normal_grid">
                    <tr>
                        <th style="width: 17%">
                            <asp:Label ID="lblemployeename" runat="server" Text="Employee Name"></asp:Label>
                        </th>
                        <td class="field" style="width: 17%">
                            <telerik:RadListBox runat="server" ID="rlbemployeename" EnableDragAndDrop="true"
                                Width="150px" Height="150px" OnClientDropped="lbemployeenamedropped">
                            </telerik:RadListBox>
                        </td>
                        <th style="width: 16%">
                            <asp:Label ID="Label1" runat="server" Text="Project Admin"></asp:Label><span class="hlt_txt">*</span>
                        </th>
                        <td class="field" style="width: 17%">
                            <telerik:RadListBox runat="server" ID="rlbadminname" EnableDragAndDrop="true" Width="150px"
                                Height="150px" OnClientDropped="lbadminnamedropped">
                            </telerik:RadListBox>
                        </td>
                        <th style="width: 16%">
                            <asp:Label ID="Label2" runat="server" Text="Project Reader"></asp:Label><span class="hlt_txt">*</span>
                        </th>
                        <td class="field" style="width: 17%">
                            <telerik:RadListBox runat="server" ID="rlbreadername" EnableDragAndDrop="true" Width="150px"
                                Height="150px" OnClientDropped="lbreadernamedropped">
                            </telerik:RadListBox>
                        </td>
                    </tr>
                </table>

     

    Javascript Code:

    function lbemployeenamedropped(sender, args) {
                    transferManager.performTransfer(sender, args);
                }
     
                function lbadminnamedropped(sender, args) {
                    transferManager.performTransfer(sender, args);
                }
     
                function lbreadernamedropped(sender, args) {
                    transferManager.performTransfer(sender, args);
                }
     
                (function ($) {
                    transferManager = function () { }
                    debugger;
                    transferManager.performTransfer = function (sender, args) {
                        var destinationItemIndex = this._getDestinationIndex(args);
                        var destinationListBox = this._getDestinationListBox(args);
     
                        if (destinationListBox == null)
                            return;
     
                        var reorderIndex = args.get_dropPosition() == 0 ?
                    destinationItemIndex : destinationItemIndex + 1;
     
                        var items = args.get_sourceItems();
     
                        this._transfer(items, destinationListBox, reorderIndex);
                    }
     
                    transferManager._transfer = function (items, destination, reorderIndex) {
                        $.each(items, function (index, item) {
                            item.unselect();
                            destination.get_items().insert(reorderIndex, item);
                        });
                    }
     
                    transferManager._getDestinationIndex = function (args) {
                        var destinationItem = args.get_destinationItem();
                        if (destinationItem)
                            return destinationItem.get_index();
                        return 0;
                    }
     
                    transferManager._getDestinationListBox = function (args) {
                        var destinationItem = args.get_destinationItem();
                         
                        if (destinationItem) {
                            var id = destinationItem.get_listBox().get_id();
                            return $find(id);
                        }
     
                        var parent = $(args.get_htmlElement()).parent();
                        if (parent.is(".RadListBox")) {
                            var id = parent[0].id;
                            return $find(id);
                        }
                        else if (parent.is(".rlbGroup")) {
                            var id = parent[0].parentNode.id;
                            return $find(id);
                             
                        }
                    }
                })($telerik.$);

     

    anything wrong in this code.

    Tanks in Advance

    ASRK.....

     

  2. Raj
    Raj avatar
    33 posts
    Member since:
    Jan 2012

    Posted 09 Mar Link to this post

    THANKS TO ALL

     

    got solution.

  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top