If you are not interested in going for JQuery auto complete or have specific need, you have the option of using a text box, which will be used to type the text to search and add a dropdownlist or list control in update panel which will be refreshed while you are typing text in textbox.
this is the code you need in your .aspx
<script type="text/javascript">
function RefreshUpdatePanel() {
__doPostBack('txtSearch', '');
};
</script>
<asp:TextBox ID="txtSearch" runat="server" onkeyup="RefreshUpdatePanel();" AutoPostBack="false" OnTextChanged="txtSearch_TextChanged" ></asp:TextBox>
<asp:UpdatePanel ID="Update" runat="server">
<ContentTemplate>
<asp:DropDownList runat="server" ID="ddlSearch" />
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="txtSearch" />
</Triggers>
</asp:UpdatePanel>
<asp:TextBox ID="txt2" runat="server"></asp:TextBox>
Below is the code needed in your code behind.
public List<string> Values { get; set; }
private void GetValues()
{
Values = new List<string>();
Values.Add("Apple");
Values.Add("Orange");
Values.Add("Banana");
Values.Add("Pear");
Values.Add("Black Berry");
Values.Add("Pineapple");
}
protected void txtSearch_TextChanged(object sender, EventArgs e)
{
var dropDownList = sender as TextBox;
var options = (from o in Values
where o.StartsWith(dropDownList.Text, StringComparison.InvariantCultureIgnoreCase)
select o).ToList();
ddlSearch.DataSource = options;
ddlSearch.DataBind();
}
This approach updates the panel contents onkeyup event of the textbox, if you need this on other event e.g. onblur, you can register it from code behind using "RegisterClientScriptBlock".
I would still recommend you to go for JQuery auto complete because it is more cleaner approach.