Re: Can you cancel the click of a checkbox?
- From: Rodger Constandse <rodgercngNOSPAM@xxxxxxxxxxx>
- Date: Thu, 30 Jun 2005 18:03:51 GMT
Hi,
It looks like the CheckState change is being performed by the OnClick handler of the CheckBox. If you want, you can create a derived CheckBox class and override the OnClick method, provide a new cancellable event (something like CheckStateChanging) that you call from your OnClick method, and only call the base OnClick method if the event is not cancelled.
Best regards,
Rodger
Sequence Diagram Editor - Draw sequence diagrams faster <http://www.SequenceDiagramEditor.com>
Byron wrote:
I want to be able to intercept the click of a checkbox to cancel a change in its checked state under certain conditions to prevent the execution of code attached to the CheckedChanged event. So when someone clicks on the checkbox I want to do some validation and on failure throw the click away, leaving the state of the checkbox unchanged.
I was looking for Cancel or Handled to manage it, but I can't find it. I suppose I could short-circuit the CheckedChanged event to flip the checked state back and skip the code, using a Boolean flag to skip the second call to CheckedChanged when I change the state back, but that's ugly.
Any suggestions would be appreciated.
.
- References:
- Can you cancel the click of a checkbox?
- From: Byron
- Can you cancel the click of a checkbox?
- Prev by Date: RE: Can you cancel the click of a checkbox?
- Next by Date: RE: Can you cancel the click of a checkbox?
- Previous by thread: RE: Can you cancel the click of a checkbox?
- Next by thread: RE: Can you cancel the click of a checkbox?
- Index(es):
Relevant Pages
|