Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET AJAX > ListBox > Get all items of RadListBox

Answered Get all items of RadListBox

Feed from this thread
  • Abhi Shinde avatar

    Posted on Jan 25, 2012 (permalink)

    Hi,,
    I am using RadListBox, I want to get all values of listbox.
    I am tying to use "get_items" method But it is showing foll. error.
    Uncaught TypeError: Object [object Object] has no method 'get_items' 
     
    ASPX code
    <script type="text/javascript" charset="utf-8">
            $(document).ready(function() {
     
     $('#<%=btnViewAssignedSlots.ClientID %>').click(function() {
                   var list = $('#<%= rdLstSource.ClientID %>');
                    var items = list.get_items();
                   var firstItem = items.getItem(0);
                    alert(firstItem);
    }
     
    });
        </script>

    <telerik:RadListBox runat="server" ID="rdLstSource" Height="200px" Width="230px"
                            AutoPostBackOnTransfer="false" AllowTransfer="true" TransferToID="rdLstDestination"
                            AllowTransferOnDoubleClick="true" EnableDragAndDrop="true" ButtonSettings-ShowTransferAll="true">
                            <Items>
                                <telerik:RadListBoxItem Text="Sunday" Value="1" />
                                <telerik:RadListBoxItem Text="Monday" Value="2"/>
                                <telerik:RadListBoxItem Text="Tuesday" Value="3"/>
                                <telerik:RadListBoxItem Text="Wednesday" Value="4"/>
                                <telerik:RadListBoxItem Text="Thursday" Value="5"/>
                                <telerik:RadListBoxItem Text="Friday" Value="6"/>
                                <telerik:RadListBoxItem Text="Saturday" Value="7"/>
                            </Items>
                        </telerik:RadListBox>

    Please help me to solve.

    Reply

  • Answer Princy MVP avatar

    Posted on Jan 25, 2012 (permalink)

    Hello,

    Try the following javascript.
    JS:
    <script type="text/javascript">
        function OnClientClick()
         {
            var list = $find("<%=RadListBox1.ClientID %>");
            for (i = 0; i < list.get_items().get_count(); i++)
            {
              alert(list.getItem(i).get_value());
            }
        }
        </script>

    Thanks,
    Princy.

    Reply

  • Answer Bozhidar Bozhidar admin's avatar

    Posted on Jan 25, 2012 (permalink)

    Hi Abhi,

    Please review the following help article, showing how to work with the RadListBox client object:
    http://www.telerik.com/help/aspnet-ajax/listbox-client-side-basics.html 
     
    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

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET AJAX > ListBox > Get all items of RadListBox