Skip to content

Instantly share code, notes, and snippets.

@kaushalparik27
Created May 14, 2017 08:26
Show Gist options
  • Save kaushalparik27/9154632dec5c4c018ec5db01cff7ffab to your computer and use it in GitHub Desktop.
Save kaushalparik27/9154632dec5c4c018ec5db01cff7ffab to your computer and use it in GitHub Desktop.
Chosen AutoComplete - Basic Configuration - 01
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<link href="Content/chosen.min.css" rel="stylesheet" />
<script src="Scripts/jquery-1.12.4.min.js"></script>
<script src="Scripts/chosen.jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function () {
InitDropDown();
})
function InitDropDown() {
var config = {
'.ChosenSelector': { allow_single_deselect: true, search_contains: true, width: "350px" },
}
for (var selector in config) {
$(selector).chosen(config[selector]);
}
}
</script>
</head>
<body>
<form id="form1" runat="server">
<asp:DropDownList
runat="server"
ID="ddlDropDown"
DataTextField="EmpName"
DataValueField="EmpId"
CssClass="ChosenSelector"
data-placeholder="Select Employee"
AppendDataBoundItems="true">
<asp:ListItem Text="" Value="-1"></asp:ListItem>
</asp:DropDownList>
</form>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment