Silk skin

MultiSelect - Client-side API

T-shirt Sizes

Demo Configurator

API Functions
Filter
  • Starts with
Select
Isolate this demo as a stand-alone application
  • About this demo
  • C#
  • VB

RadMultiSelect for ASP.NET AJAX is based on the Kendo UI MultiSelect Widget. Thus, it exposes the Client-side API and methods offered by the widget and mainly provides a wrapper and API for working with the MultiSelect on the server.
You can get Client-side Object Reference to the MultiSelect control in order to use its API like this:

var RadMultiSelectObject = $find("<%=RadMultiSelect1.ClientID %>");

The most commonly used RadMultiSelect client-side methods are:

  • set_enabled—Enables or disables the widget.
  • set_readOnly—Toggles the readonly state of the widget. When the widget is readonly it doesn't allow user input.
  • open—Opens the popup.
  • close—Closes the widget popup.
  • toggle—Opens or closes the widget popup.
  • search—Searches the data source for the provided value and displays any matches as suggestions.
  • get_value and set_value—Gets or sets the value of the MultiSelect.

You can find the full client-side API of the control in the RadMultiSelect Client-side API documentation article.


Get Client-side Object Reference to the Kendo MultiSelect widget in order to use its API

There are two ways to get a reference to the Kendo MultiSelect widget in order to use its API:

  • Use the get_kendoWidget method the RadMultiSelect client-side object exposes. You can get the RadMultiSelect object through the $find() MS AJAX method:

    var RadMultiSelectObject  = $find("<%=RadMultiSelect1.ClientID %>"); //the standard script control object
    var kendoMultiSelectObject = RadMultiSelectObject.get_kendoWidget(); //the Kendo widget

  • Use the standard Kendo approach for getting the widget through the data-attributes of the DOM element:

    var kendoMultiSelectObject = $telerik.$("#<%=RadMultiSelect1.ClientID %>").data("kendoMultiSelect"); //the jQuery selector must get the RadMultiSelect1 select element

  • DefaultCS.aspx
  • scripts.js
  • styles.css
<%@ Page Language="c#" AutoEventWireup="true"  %>

<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns='http://www.w3.org/1999/xhtml'>
<head runat="server">
    <title>Telerik ASP.NET Example</title>
    <link href="styles.css" rel="stylesheet" />
    <script src="scripts.js"></script>
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
    <telerik:RadSkinManager ID="RadSkinManager1" runat="server" ShowChooser="true" />
    <div class="demo-container size-narrow" runat="server">
        <h4>T-shirt Sizes</h4>
        <telerik:RadMultiSelect runat="server"
            Placeholder="Select movie..."
            DataTextField="text"
            DataValueField="value"
            Width="400px"
            ID="RadMultiSelect1">
            <Items>
                <telerik:MultiSelectItem Text="12 Angry Men" Value="1" />
                <telerik:MultiSelectItem Text="Il buono, il brutto, il cattivo." Value="2" />
                <telerik:MultiSelectItem Text="Inception" Value="3" />
                <telerik:MultiSelectItem Text="One Flew Over the Cuckoo's Nest" Value="4" />
                <telerik:MultiSelectItem Text="Pulp Fiction" Value="5" />
                <telerik:MultiSelectItem Text="Schindler's List" Value="6" />
                <telerik:MultiSelectItem Text="The Dark Knight" Value="7" />
                <telerik:MultiSelectItem Text="The Godfather" Value="8" />
                <telerik:MultiSelectItem Text="The Godfather: Part II" Value="9" />
                <telerik:MultiSelectItem Text="The Shawshank Redemption" Value="10" />
                <telerik:MultiSelectItem Text="The Shawshank Redemption 2" Value="11" />
            </Items>
        </telerik:RadMultiSelect>
    </div>
    <script>
        function pageLoadHandler() {
            window.demoIDs = {
                tbWord: '<%= tbWord.ClientID %>',
                tbValue: '<%= tbValue.ClientID %>'
            };

            window.multiSelect = $find("<%= RadMultiSelect1.ClientID %>");
        }

        Sys.Application.add_load(pageLoadHandler);
    </script>
    <qsf:ConfiguratorPanel runat="server" ID="rmccbConfigurationPanel">
        <Views>
            <qsf:View>
                <qsf:ConfiguratorColumn runat="server" Size="Medium" Title="API Functions">
                    <ul class="fb-group">
                        <li>
                            <qsf:Button Width="100" runat="server" ID="btnEnable" Text="Enable" AutoPostBack="false" OnClientClicked="enable" />
                            <qsf:Button Width="100" runat="server" ID="btnDisable" Text="Disable" AutoPostBack="false" OnClientClicked="disable" />
                        </li>
                        <li>
                            <qsf:Button Width="205" runat="server" ID="btnReadonly" Text="Readonly" AutoPostBack="false" OnClientClicked="readonly" />
                        </li>
                        <li>
                            <qsf:Button Width="100" runat="server" ID="btnOpen" Text="Open" AutoPostBack="false" OnClientClicked="open" />
                            <qsf:Button Width="100" runat="server" ID="btnClose" Text="Close" AutoPostBack="false" OnClientClicked="close" />
                        </li>
                        <li>
                            <qsf:Button Width="205" runat="server" ID="btnGetValue" Text="Get Values" AutoPostBack="false" OnClientClicked="getValue" />
                        </li>
                    </ul>
                </qsf:ConfiguratorColumn>
                <qsf:ConfiguratorColumn runat="server" Size="Narrow" Title="Filter">
                    <ul class="fb-group">
                        <li>
                            <qsf:DropDownList ID="ddlFilter" Width="200" OnClientSelectedIndexChanged="filterTypeOnChanged" runat="server" RenderMode="Lightweight">
                                <Items>
                                    <telerik:DropDownListItem Text="Starts with" Value="0" />
                                    <telerik:DropDownListItem Text="Contains" Value="1" />
                                    <telerik:DropDownListItem Text="Ends with" Value="2" />
                                </Items>
                            </qsf:DropDownList>
                        </li>
                        <li>
                            <qsf:TextBox runat="server" ID="tbWord" Width="200" Text="The" >
                                <ClientEvents OnKeyPress="tbWordKeyPress" />
                            </qsf:TextBox>
                        </li>
                        <li>
                            <qsf:Button runat="server" ID="btnFind" Width="200" Text="Find Item" AutoPostBack="false" OnClientClicked="findItem" />
                        </li>
                    </ul>
                </qsf:ConfiguratorColumn>
                <qsf:ConfiguratorColumn runat="server" Size="Wide" Title="Select">
                    <ul class="fb-group">
                        <li>
                            <qsf:TextBox runat="server" ID="tbValue" Text="1,2" Width="50px">
                                <ClientEvents OnKeyPress="tbValueKeyPress" />
                            </qsf:TextBox>
                            <qsf:Button runat="server" ID="btnSetValue" Width="150" Text="Select by value" AutoPostBack="false" OnClientClicked="setValue" />
                        </li>
                    </ul>
                </qsf:ConfiguratorColumn>
            </qsf:View>
        </Views>
    </qsf:ConfiguratorPanel>
    </form>
</body>
</html>

Support & Learning Resources

Find Assistance

Help Us Improve

Was this example helpful?