简体   繁体   中英

Searchable CheckListBox in webform asp.net

I have a checklistbox getting list of element from database and its working fine, I want to make it searchable ie User may type and search any Name from List and submit the form.

<asp:CheckBoxList ID="chkJudges" runat="server" Font-Bold="false" Font-Names="verdana" Font-Size="8pt" ForeColor="#444444"></asp:CheckBoxList>

how can I search Items without postback request.

Thanks In Advance

Use JQuery to make it searchable

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
            <script type="text/jscript">
                function Search() {

                    var t = document.getElementById("txtSearching").value;

                   $('#cphContentBody_chkJudges tbody tr').each(function () {

                       var str = $(this).text();
                       if (str.toUpperCase().indexOf(t.toUpperCase()) >= 0) {

                           $(this).show();
                       } else {
                           $(this).hide();
                       }
                   });

                }

            </script>
            <input  type="text" id='txtSearching' onInput="return Search();" />

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM