Using RadioButton Controls inside a Repeater (groupname problem)

Radio Buttons have the attribute ‘groupname’. The point of this attribute to to ensure any radio buttons in the same group are mutely exclusive (only one in the group can be selected).

This is the case when using them normally but as soon as you put them into a repeater control (e.g. datalist) .Net scrambles the group name value and it no longer works as a group. All can be selected.

This can be fixed with a bit of Javascript and some code during the list databinding event (provided by Microsoft).

See this link -> http://www.codeguru.com/csharp/csharp/cs_controls/custom/article.php/c12371/

Works for .Net 1.0 and 2.0.