Ajax


First Register ajaxcontrol toolkit
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajax" %>
 <asp:TextBox ID="txtAutoComplete" runat="server"></asp:TextBox>
        <ajax:AutoCompleteExtender ID="atcExteder" runat="server" TargetControlID="txtAutoComplete"
            ServiceMethod="GetKits" ServicePath="~/AutoComplete.asmx" MinimumPrefixLength="1"
            UseContextKey="true" CompletionInterval="500">
        </ajax:AutoCompleteExtender>

 add this method to autocomplete.aspx.cs

  <System.Web.Services.WebMethod()> _
    Public Function GetKits(ByVal prefixText As String, ByVal count As Integer) As List(Of String)
        Dim db As New DataClasses1DataContext()
        Dim data = db.tblKitTemplateHeaders.Where(Function(n) n.CustomKitPartNumber.StartsWith(prefixText)).OrderBy _
            (Function(xe) xe.CustomKitPartNumber).Select(Function(c) c.CustomKitPartNumber).Take(count).ToList()
        Return data
    End Function
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s