RadioButton Change validation

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • rino

    RadioButton Change validation

    Hi
    I have 2 radio buttons and want to perform some kind of validation before I
    allow the checked state to move from one to another. I tried overriding the
    validating callback but I noticed that it is called when loosing focus and
    that is not good enough because I need to know when one radio button is
    checked.
    The only way I found is to create a class deriving from RadioButton and I
    override the OnClick event. I have an event handler that you can register to
    and can confirm of the click should be performed or not.

    Isnt there any built in way to handle this. ?

    public class ControlledRadio Button : RadioButton
    {

    public delegate bool ConfirmClick(Ev entArgs e);
    public event ConfirmClick ConfirmClickEve nt = null;
    protected override void OnClick(EventAr gs e)
    {
    if(ConfirmClick Event == null || ConfirmClickEve nt(e))
    base.OnClick(e) ;
    }
    }
    Thanks



Working...