PerformClick() for a radio button not working

Posted by anup on Stack Overflow See other posts from Stack Overflow or by anup
Published on 2013-10-21T16:38:01Z Indexed on 2013/10/23 9:55 UTC
Read the original article Hit count: 1230

Filed under:

There is a usercontrol which has a radio button and that user control is called in a dialog box. I have written an onclick event for radio button and used performclick() to call it. But even though performclick() is being executed without any exception, it's not performing on click action. It's neither calling on click function nor reflecting a check in UI. But the on-click event works perfectly if I click it manually in the UI.

I am using VS2010 and to test the case I created a helloworld project. I observed the app worked well when the Causesvalidation property of radiobutton is false, but doesn't when that validation property is true.

How can I fix this?

More: As I researched more I found out that Performclick doesn't work well when controls are called inside other controls and when this is done for many layers. It was same in my case, there were four layers to reach my radiobutton. So I replaced the prformclick function by calling onclick function directly and then making radiobutton.checked = true inside that function.

© Stack Overflow or respective owner

Related posts about c#