I just fixed a bug in my code but I don’t understand why this was happening.
I have a LabelFor(u => u.SomeName, "Select a value"). SomeName is an enum value and the control is a radio button group. When I click on the label it changes the radio button group’s value to the first radio button which would also be the default value for that enum.
When I changed all of my LabelFors to Label I don’t have the issue so the bug is fixed there but I really want to understand this.
Can anyone tell me why is it that clicking a LabelFor label will change my radio button value?
After a little bit more research I understand it now but I’m not going to delete this just in case anybody else comes across this.
The labelfor makes a
<label for='element'>when that label is clicked it will also select the control that it is bound to.In this case I am selecting the default value for the enum that is bound to the label.