Remove element of a double click Radlistbox

3 posts, 0 answers
  1. Andrew
    Andrew avatar
    3 posts
    Member since:
    Apr 2013

    Posted 09 May 2013 Link to this post

    I was able to copy items from one radListBox to another but I could not delete them by double clicking on the item. thanks for your help
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 10 May 2013 Link to this post

    Hi Andrew,

    Please have a look at the following sample code I tried which works fine at my end.

    ASPX:
    <telerik:RadListBox ID="RadListBox1" runat="server" OnClientItemDoubleClicked="OnClientItemDoubleClicked"
        SelectionMode="Single">
        <Items>
            <telerik:RadListBoxItem runat="server" Text="Item1" />
            <telerik:RadListBoxItem runat="server" Text="Item2" />
            <telerik:RadListBoxItem runat="server" Text="Item3" />
            <telerik:RadListBoxItem runat="server" Text="Item4" />
        </Items>
    </telerik:RadListBox>

    JavaScript:
    <script type="text/javascript">
        function OnClientItemDoubleClicked(sender, args) {
            listBox = $find("<%= RadListBox1.ClientID %>");
            var item = args.get_item();
            listBox.trackChanges();
            listBox.get_items().remove(item);
            listBox.commitChanges();
            return false;
        }
    </script>

    Thanks,
    Shinu.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Andrew
    Andrew avatar
    3 posts
    Member since:
    Apr 2013

    Posted 10 May 2013 Link to this post

    Thank you very much, it worked correctly
Back to Top