Link to home
Start Free TrialLog in
Avatar of ardolino
ardolino

asked on

Detect Shift or Control Click

I am trying to implement a screen similar to a windows listbox multiple-item selection (ctrl or shift click).  On windows, I can select non-continuous items by holding down the control key.

On my ASP.NET page,  I have a datagrid with a checkbox in a column that allows me to select multiple items.  Right now, I can get everything to work, but in order to start a new selection, I have to de-select everything that was previously selected.  I know I can clear the other checkboxes when the user checks off something else.  If I do this, is there anyway to detect a control click or a shift click so that I can determine whether or not to clear previously checked items or if I should allow multiple items to be selected.

I don't know if this is possible, but I'd just thought I'd ask.  If this is not possible, what would be the best way to implement a multiple item selection in a datagrid?
Avatar of EBatista
EBatista

check out this free custom control, it will do the job for you:
http://www.metabuilders.com/Tools/RowSelectorColumn.aspx

regards
Avatar of ardolino

ASKER

I already have something like this and its working.  I need to know if you can detect a control click or a shift click from the web.  The problem with this control is that the user has to deselect the items after selecting them and performing an action on them.  I would prefer that the checkboxes work like the radio boxes UNLESS the user clicks on them with the control or the shift key.
mmm...i've never tackled what you want, but if there is a way to accomplish that, it will be using client side javascript.
mmm...i've never tackled what you want, but if there is a way to accomplish that, it will be using client side javascript, discard pure server code solution here.
Ok, so now my question is... how?
ASKER CERTIFIED SOLUTION
Avatar of armoghan
armoghan
Flag of Pakistan image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thank you.  This is exactly what I wanted.