Solved

How can I make a dropdown list with autocomplete in VB.NET and SQL?

Posted on 2010-08-18
6
1,161 Views
Last Modified: 2012-06-21
I have a web application with 3 drop down lists that are populated from a SQL database. Each drop down displays over 5,000 results. How can I make a drop down list with autocomplete in VB.NET and SQL.  

If the person types SN then about 10 results would display like snail,snakes, snorkel. The based on the selection another textbox is populated with a numeric ID number.

So if I selected snake in one drop down field the other text field next to it would display '000450'

I have limited .NET experience and would appreciate a code sample if possible.  I was trying to use the ajax autocomplete but their website is not .NET newbie friendly.

Thanks!
<%@ Page Language="VB" AutoEventWireup="false" %>

<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="asp" %>

<!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 id="Head1" runat="server">
    <title>Auto Complete Test</title>
</head>
<body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
       
     </asp:ScriptManager>

         <div>

             <asp:DropDownList ID="DropDownList1" runat="server">
             </asp:DropDownList>
             <asp:DynamicPopulateExtender ID="DropDownList1_DynamicPopulateExtender" 
                 runat="server" Enabled="True" PopulateTriggerControlID="" 
                 TargetControlID="DropDownList1"></asp:DynamicPopulateExtender>
            <asp:TextBox ID="Name" runat="server">
            </asp:TextBox><br><br>
               <asp:DropDownList ID="DropDownList2" runat="server">
             </asp:DropDownList>
             <asp:DynamicPopulateExtender ID="DropDownList2_DynamicPopulateExtender" 
                 runat="server" Enabled="True" PopulateTriggerControlID="" 
                 TargetControlID="DropDownList2"></asp:DynamicPopulateExtender>
            <asp:TextBox ID="TextBox1" runat="server">
            </asp:TextBox><br><br>
                <asp:DropDownList ID="DropDownList3" runat="server">
             </asp:DropDownList>
             <asp:DynamicPopulateExtender ID="DropDownList3_DynamicPopulateExtender" 
                 runat="server" Enabled="True" PopulateTriggerControlID="" 
                 TargetControlID="DropDownList3"></asp:DynamicPopulateExtender>
            <asp:TextBox ID="TextBox2" runat="server">
            </asp:TextBox><br><br>
            </div>
    </form>
</body>
</html>

Open in new window

0
Comment
Question by:Rosabella
  • 3
  • 3
6 Comments
 
LVL 5

Expert Comment

by:muhammadyasir
Comment Utility
0
 
LVL 5

Expert Comment

by:muhammadyasir
Comment Utility
0
 

Author Comment

by:Rosabella
Comment Utility
Hi Muhammadyasir,

I have seen those but they do not provide source code regarding the population of the combobox from a db. I have tried using that snippet, it also requires a webservice which I am unfamiliar with. I am a newbie to vb.net if you can provide me with source code to a working sample that would be great.

sincerely,
Rosabella
0
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 5

Expert Comment

by:muhammadyasir
Comment Utility
just go through this page it is being used in c# and Javascript. it is great one.

http://www.codeproject.com/KB/webforms/AjaxComboBoxControl.aspx
0
 

Accepted Solution

by:
Rosabella earned 0 total points
Comment Utility
0
 

Author Comment

by:Rosabella
Comment Utility
The suggestions offered by the only member who answered my question I already had reviewed previously.  I was looking for more than just regurgitation from a website, as a newbie I was looking for a code sample in VB.NET not C# and found it.
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
This video discusses moving either the default database or any database to a new volume.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now