Move the focus away

S

Samuel Shulman

I have a common problem that when the user changed the selection in the
DropDownList control and the program responded appropriately the focus
remains there and if the user will press on the Arrow Up or arrow down
buttons the selection of the DropDown will change which is not normally
required

Is there any way to remove the focus away from the dropdown control?

Thank you

Samuel
 
P

Paul Henderson

I have a common problem that when the user changed the selection in the
DropDownList control and the program responded appropriately the focus
remains there and if the user will press on the Arrow Up or arrow down
buttons the selection of the DropDown will change which is not normally
required
Is there any way to remove the focus away from the dropdown control?

Perhaps the easiest way to do this would be to put some Javascript to
be executed on the client side after the user changes their selection
in the dropdown; you can call the this.blur() method in the client-side
Change event for the dropdown to remove the focus from it.

-- PH
 
S

Samuel Shulman

It is a server side control so how can I trigger the JavaScript
Thank you
Samuel
 
P

Paul Henderson

It is a server side control so how can I trigger the JavaScript

If you add an onchange attribute containing the Javascript to the
control from your Page_Load event, then it'll be run when the user
changes the selection [I'm presuming there's no postback until the user
explicitly clicks Submit or whatever]. The attribute should just be
attached to the <select...> tag created by the server control.

So use
my_dropdown . Attributes . Add( "onchange", "this.blur();" ) ;

-- PH
 
J

Jan Hyde

"Samuel Shulman" <[email protected]>'s wild
thoughts were released on Wed, 14 Jun 2006 18:48:35 +0100
bearing the following fruit:
I have a common problem that when the user changed the selection in the
DropDownList control and the program responded appropriately the focus
remains there and if the user will press on the Arrow Up or arrow down
buttons the selection of the DropDown will change which is not normally
required

Is there any way to remove the focus away from the dropdown control?

As a side note I'm surprised you refer to this as a 'common
problem' I see it as essential and expected behavior.



Jan Hyde (VB MVP)
 
S

Samuel Shulman

It is useful some times but on other occasion users want to scroll down the
page after they selected an entry from the list
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,780
Messages
2,569,608
Members
45,244
Latest member
cryptotaxsoftware12

Latest Threads

Top