Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old July 19th, 2005, 01:07 PM
Ben
Guest
 
Posts: n/a
Default Disable auto-search in listbox control

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
  #2  
Old July 19th, 2005, 01:08 PM
Bob Barrows [MVP]
Guest
 
Posts: n/a
Default Re: Disable auto-search in listbox control

Ben wrote:[color=blue]
> 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?
>[/color]

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/ind...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"


  #3  
Old July 19th, 2005, 01:08 PM
Ben
Guest
 
Posts: n/a
Default Re: Disable auto-search in listbox control

"Bob Barrows [MVP]" <reb01501@NOyahoo.SPAMcom> wrote in message news:<#dpTEBpMEHA.1644@TK2MSFTNGP09.phx.gbl>...[color=blue]
> Ben wrote:[color=green]
> > 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?
> >[/color]
>
> 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/ind...asp&c=&a=clear
>
> Bob Barrows[/color]

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

Regards,

Ben
 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles