Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4620076
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T02:30:41+00:00 2026-05-22T02:30:41+00:00

i have an input using the jquery autocomplete plugin. with this i want to

  • 0

i have an input using the jquery autocomplete plugin. with this i want to return 5 results. I was making this happen by just entering 5 return results in the stored procedure that im using, but i want to remove duplicates, while still showing 5 results. im not sure the best way to go about doing this
here is my code behind for the callback page

Public Class SearchCallback
Inherits System.Web.UI.Page

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    Response.Clear()
    Dim searchText As String = Request("searchText")
    Dim searchField As String = Request("searchField")


    Dim dtCustomer As CustomerCollection = CustomerService.SearchRecords(searchText, searchField, "Contains", searchField, "Asc", CInt("1"), CInt("5"))
    Dim returnString As String
    If searchField = "Company" Then
        For Each drCustomer As Customer In dtCustomer
            If returnString = "" Then
                returnString = drCustomer.Company
            else
                returnString = returnString & "," & drCustomer.Company
            End If
        Next
        Response.Write(returnString)

i had a list of more searchfield options after that to give me the data i want. Im putting the needed info into a string so i can use it with my javascript code as follows.

$(document).ready(function () {
$(".searchTextBox").autocomplete({
    source: callback,
    autoFill: true
});
});

var callback = function (request, response) {
var searchText = request.term;
var searchField = $(".ddlist > option:selected").attr("value");
$.ajax({
    type: "GET",
    dataType: "text",
    url: "SearchCallback.aspx?searchText=" + searchText + "&searchField=" + searchField,
    success: function (data) {
        var splitData = data.split(",");
        response(splitData);
    }
});
}

everything works other then the duplication problem that im having.. please help!


its kinda messy but i got it working as i want with the following code

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    Response.Clear()
    Dim searchText As String = Request("searchText")
    Dim searchField As String = Request("searchField")
    Dim lastValue As String
    Dim resultsCounter As Integer = 0

    Dim dtCustomer As CustomerCollection = CustomerService.SearchRecords(searchText, searchField, "Contains", searchField, "Asc", CInt("1"), CInt("100"))
    Dim returnString As String
    If searchField = "Company" Then
        resultsCounter = 0
        For Each drCustomer As Customer In dtCustomer
            If returnString = "" Then
                returnString = drCustomer.Company
                lastValue = drCustomer.Company
                resultsCounter += 1
            ElseIf resultsCounter < 6 Then
                If lastValue <> drCustomer.Company Then
                    returnString = returnString & "," & drCustomer.Company
                    lastValue = drCustomer.Company
                    resultsCounter += 1
                End If
            End If
        Next

        Response.Write(returnString)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T02:30:42+00:00Added an answer on May 22, 2026 at 2:30 am

    What kind of ORM framework are you using? With SQL the DISTINCT keyword is used for this, that might help

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using the jQuery autocomplete plugin and have wired up an input field
I am using this plugin: http://jquery.bassistance.de/autocomplete/demo/ I have an autocomplete textarea where the values
I'm using jQuery UI Autocomplete 1.8.1 with Jquery 1.4.2 and I have this issue.
I'm using Jörn Zaefferers autocomplete plugin for jQuery to enable a live search field,
I have this version of jQuery-autocomplete: jQuery Autocomplete Mod , It's cool with me
I am using the deprecated autocomplete plugin (since I'm using the legacy jquery lib
How can I validate the user input by using scanf. Right now I have
I have a situation where I have to take input from the user using
I have a simple form with some plain html input like bellow using ASP.NET
I have created a C# class file by using a XSD-file as an input.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.