Disable auto-search in listbox control

Discussion in 'ASP General' started by Ben, May 5, 2004.

  1. Ben

    Ben Guest

    I've got an asp page that populates a listbox with info from a db.

    The list box ends up being pretty big, so I want to be able to search
    it effectively. I like the method wherein the user types the letters
    of the word they are looking for from within the listbox and the
    control automatically scrolls to the item matching the chars they have
    typed thus far.

    Example:

    If the listbox were to contain states Alabama, Alaska, and Louisiana,
    when the user clicked in the listbox and typed "Ala" the box would
    scroll to Alabama, and when they typed an additional 's', so the typed
    string was "Alas", the box would scroll to Alaska.

    Problem:

    I've got javascript that does this very well, but the listbox control
    default search behavior overrides my javascript. So, the javascript
    will correctly index to Alaska when "Alas" is typed, but when the
    javascript function is done running, the list moves down to Louisiana,
    because the asp control thinks that by typing 'l' the user wants to
    move to the first item in the box beginning with an 'l'.

    Question:

    Can I disable the default search behavior in the control? If so, how?
    If not, does anyone have any thoughts on how else I might get around
    this problem?

    Thanks and regards,

    Ben
    Ben, May 5, 2004
    #1
    1. Advertising

  2. Ben wrote:
    > I've got an asp page that populates a listbox with info from a db.
    >
    > The list box ends up being pretty big, so I want to be able to search
    > it effectively. I like the method wherein the user types the letters
    > of the word they are looking for from within the listbox and the
    > control automatically scrolls to the item matching the chars they have
    > typed thus far.
    >
    > Example:
    >
    > If the listbox were to contain states Alabama, Alaska, and Louisiana,
    > when the user clicked in the listbox and typed "Ala" the box would
    > scroll to Alabama, and when they typed an additional 's', so the typed
    > string was "Alas", the box would scroll to Alaska.
    >
    > Problem:
    >
    > I've got javascript that does this very well, but the listbox control
    > default search behavior overrides my javascript. So, the javascript
    > will correctly index to Alaska when "Alas" is typed, but when the
    > javascript function is done running, the list moves down to Louisiana,
    > because the asp control thinks that by typing 'l' the user wants to
    > move to the first item in the box beginning with an 'l'.
    >
    > Question:
    >
    > Can I disable the default search behavior in the control? If so, how?
    > If not, does anyone have any thoughts on how else I might get around
    > this problem?
    >


    This is not an asp issue (you would have the same problem if you put the
    control on a non-asp page would you not?). Please follow up in a client-side
    scripting newsgroup such as one of the ones with "dhtml" and "scripting" in
    their names, or the m.p.scripting.jscript newsgroup.

    I have created a demo illustrating one way to do this at
    http://www.thrasherwebdesign.com/index.asp?pi=links&hp=links.asp&c=&a=clear

    Bob Barrows


    --
    Microsoft MVP - ASP/ASP.NET
    Please reply to the newsgroup. This email account is my spam trap so I
    don't check it very often. If you must reply off-line, then remove the
    "NO SPAM"
    Bob Barrows [MVP], May 5, 2004
    #2
    1. Advertising

  3. Ben

    Ben Guest

    "Bob Barrows [MVP]" <> wrote in message news:<#>...
    > Ben wrote:
    > > I've got an asp page that populates a listbox with info from a db.
    > >
    > > The list box ends up being pretty big, so I want to be able to search
    > > it effectively. I like the method wherein the user types the letters
    > > of the word they are looking for from within the listbox and the
    > > control automatically scrolls to the item matching the chars they have
    > > typed thus far.
    > >
    > > Example:
    > >
    > > If the listbox were to contain states Alabama, Alaska, and Louisiana,
    > > when the user clicked in the listbox and typed "Ala" the box would
    > > scroll to Alabama, and when they typed an additional 's', so the typed
    > > string was "Alas", the box would scroll to Alaska.
    > >
    > > Problem:
    > >
    > > I've got javascript that does this very well, but the listbox control
    > > default search behavior overrides my javascript. So, the javascript
    > > will correctly index to Alaska when "Alas" is typed, but when the
    > > javascript function is done running, the list moves down to Louisiana,
    > > because the asp control thinks that by typing 'l' the user wants to
    > > move to the first item in the box beginning with an 'l'.
    > >
    > > Question:
    > >
    > > Can I disable the default search behavior in the control? If so, how?
    > > If not, does anyone have any thoughts on how else I might get around
    > > this problem?
    > >

    >
    > This is not an asp issue (you would have the same problem if you put the
    > control on a non-asp page would you not?). Please follow up in a client-side
    > scripting newsgroup such as one of the ones with "dhtml" and "scripting" in
    > their names, or the m.p.scripting.jscript newsgroup.
    >
    > I have created a demo illustrating one way to do this at
    > http://www.thrasherwebdesign.com/index.asp?pi=links&hp=links.asp&c=&a=clear
    >
    > Bob Barrows


    Thanks for the pointer as well as the example. I'll try some other groups.

    Regards,

    Ben
    Ben, May 5, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ian
    Replies:
    0
    Views:
    395
  2. John Holmes

    Is there a way to disable auto-formatting

    John Holmes, Apr 9, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    356
    Steven Cheng[MSFT]
    Apr 10, 2004
  3. =?Utf-8?B?V2FyYW4=?=

    Auto-Suggested Textbox like google auto suggest

    =?Utf-8?B?V2FyYW4=?=, Apr 20, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    8,512
    inrakeshworld
    Jul 27, 2007
  4. linkswanted
    Replies:
    1
    Views:
    904
  5. Abby Lee
    Replies:
    5
    Views:
    400
    Abby Lee
    Aug 2, 2004
Loading...

Share This Page