RadRadioButton

1 Answer 121 Views
Buttons, RadioButton, CheckBox, etc
Mark
Top achievements
Rank 2
Bronze
Bronze
Veteran
Mark asked on 03 Nov 2023, 12:38 PM

I have a simple form, in which the first two controls are radio buttons. I dont' want either radio button checked, but no matter what I do, the first radio button is always checked when I run the form.   I want the user to have to pick one of the radio buttons, and if they don't we have code that warns a one of the radio buttons must be picked.   Witht hat said, I am kind of stuck, as I played with setting them both to IsChecked = false and CheckState = CheckState.UnChecked, but the first RadioButton, at runtime, gets checked anyway.   

 

Also, I don't want the radio button to auto check when the user uses the ARROW keys to switch between them. I want the user to have to either click the SPACE BAR or click with the mouse, is this possible.

 

TIA

1 Answer, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 08 Nov 2023, 06:10 AM

Hi, Mark,

Following the provided information, I have created a brand new project and added two RadRadioButton controls on the form. Indeed, when I run the application, the first RadRadioButton is toggled even though I set explicitly its ToggleState property to Off. This is observed if only these two controls are on the form or one of the RadRadioButtons is the active control when the application starts. If you focus another control, e.g. RadTextBox when the application starts, none of the radio buttons is checked.

The possible solution that i can suggest is to handle the form's Shown event and un-toggle the radio button:

      private void RadForm1_Shown(object sender, EventArgs e)
      {
          this.radRadioButton1.ToggleState = Telerik.WinControls.Enumerations.ToggleState.Off;
      }

I hope this information helps. If you need any further assistance please don't hesitate to contact me. 

Regards,
Dess | Tech Support Engineer, Principal
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Mark
Top achievements
Rank 2
Bronze
Bronze
Veteran
commented on 08 Nov 2023, 11:20 AM

Yea, that doesn't work, if the radio button is the first control to be focused when the form shows.  My work around was to set another control (non- radio button) as focus by default and then set my radio button Focus in code.   
Dess | Tech Support Engineer, Principal
Telerik team
commented on 10 Nov 2023, 07:33 PM

Hi, Mark, please have in mind that the same behavior is observed with the standard MS RadioButton when activating the first control on the form. Hence, it is expected behavior. Feel free to use the suggested approach if it fits your requirement.
Mark
Top achievements
Rank 2
Bronze
Bronze
Veteran
commented on 13 Nov 2023, 11:29 AM

Thanks for this update, I have a work around for it, thanks.
Tags
Buttons, RadioButton, CheckBox, etc
Asked by
Mark
Top achievements
Rank 2
Bronze
Bronze
Veteran
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or