selecting upto four tokens

2 posts, 1 answers
  1. Lovella Bacaud
    Lovella Bacaud avatar
    20 posts
    Member since:
    Apr 2013

    Posted 05 Aug 2013 Link to this post

    Hi
    I am using an autocompletebox in my form to enter tokens. After selecting four token I want to disable further token selection. But the user should be able to delete one and add another.

    Thanks
    Lovella
  2. Answer
    Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 05 Aug 2013 Link to this post

    Hi Lovella,

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

    ASPX:
    <telerik:RadAutoCompleteBox ID="RadAutoCompleteBox1" runat="server" Label="Enter Name : "
        OnClientDropDownOpening="OnClientDropDownOpening" Width="400px" InputType="Token"
        DataSourceID="SqlDataSource1" DataTextField="ContactName">
    </telerik:RadAutoCompleteBox>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
        SelectCommand="select ContactName from [Customers]"></asp:SqlDataSource>

    JavaScript:
    <script type="text/javascript">
        function OnClientDropDownOpening(sender, args) {
            if (sender.get_entries().get_count() >= 4) {
                args.set_cancel(true);
            }
        }
    </script>

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