Click here to Skip to main content
15,905,781 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Hi !
i will try to do filtered dropdown with checkboxs.

Code :-
C#
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <style type="text/css">

        .PnlDesign
        {
            border: solid 1px #000000;
            height: 150px;
            width: 330px;
            overflow-y:scroll;
            background-color: #EAEAEA;
            font-size: 15px;
            font-family: Arial;
        }
        .txtbox
        {
            background-image: url(../images/drpdwn.png);
            background-position: right top;
            background-repeat: no-repeat;
            cursor: pointer;
            cursor: hand;
        }
    </style>
</head>
<body>
   <form id="Form1" runat="server">
  <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <div>
        <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
            <ContentTemplate>
                <asp:TextBox ID="txtCustomer" Text="Select Customers" runat="server" CssClass="txtbox"
                    Height="20px" Width="322px"></asp:TextBox>
                <asp:Panel ID="PnlCust" runat="server" CssClass="PnlDesign" style="text-align:left">
                    <asp:CheckBoxList ID="cblCustomerList" runat="server" AutoPostBack="true"
                        onselectedindexchanged="cblCustomerList_SelectedIndexChanged">
                        <asp:ListItem>Customer One</asp:ListItem>
                        <asp:ListItem>Customer Two</asp:ListItem>
                        <asp:ListItem>Customer Three</asp:ListItem>
                        <asp:ListItem>Customer Four</asp:ListItem>
                        <asp:ListItem>Customer Five</asp:ListItem>
                        <asp:ListItem>Customer Six</asp:ListItem>
                        <asp:ListItem>Customer Seven</asp:ListItem>
                    </asp:CheckBoxList>
                </asp:Panel>
                 <asp:Button ID="Button1" runat="server" Text="Reset" onclick="Button1_Click" />
                <br />
                <cc1:DropDownExtender ID="PceSelectCustomer"  runat="server" TargetControlID="txtCustomer"
                    DropDownControlID="PnlCust" HighlightBorderColor="ActiveCaptionText">
                </cc1:DropDownExtender>
             
            </ContentTemplate>
        </asp:UpdatePanel>
    </div>

    </form>
</body>
</html<a href=""></a><a href=""></a><a href=""></a>>



here "i want the filtered dropdown", i was tried number of codes but i didn't get the exact filtered solution could u please help to solve this code .
Posted
Updated 30-Oct-14 3:42am
v3
Comments
Laiju k 31-Oct-14 0:12am    
I don't find any jquery code
Member 10305232 31-Oct-14 0:47am    
yes ! but actually i was try so many codes, here i was remove the filter jquery code and display only working ajax code ...

i want help from u to solve filter concept !!
Laiju k 31-Oct-14 0:50am    
Are you trying to filter dropdown with cblCustomerList_SelectedIndexChanged
Member 10305232 31-Oct-14 5:52am    
yes !! It was my java script code but it was not working in my side .
Java Script :-
<script language = "javascript">
(function(document) {
'use strict';

var LightTableFilter = (function(Arr) {

var _input;

function _onInputEvent(e) {
_input = e.target;
var tables = document.getElementsByClassName(_input.getAttribute('data-table'));
Arr.forEach.call(tables, function(table) {
Arr.forEach.call(table.tBodies, function(tbody) {
Arr.forEach.call(tbody.rows, _filter);
});
});
}

function _filter(row) {
var text = row.textContent.toLowerCase(), val = _input.value.toLowerCase();
row.style.display = text.indexOf(val) === -1 ? 'none' : 'table-row';
}

return {
init: function() {
var inputs = document.getElementsByClassName('light-table-filter');
Arr.forEach.call(inputs, function(input) {
input.oninput = _onInputEvent;
});
}
};
})(Array.prototype);

document.addEventListener('readystatechange', function() {
if (document.readyState === 'complete') {
LightTableFilter.init();
}
});

})(document);
</script>

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900