How to Make Tab index work for Radio Buttons which are in same group?
I have a scenario like this
<asp:RadioButton ID="userActiveYesRadioButton" GroupName="activeGroup" Text="Yes"
runat="server" TabIndex="4" />
<开发者_开发百科;asp:RadioButton ID="userActiveNoRadioButton" GroupName="activeGroup" Text="No"
runat="server" TabIndex="5" />
Since these radio buttons are in same group , tab index is not working. Is is possible to make tabindex work in this scenario ? If I remove the group , they dont remain mutually exclusive.
Thanks in Advance
You can use an alternate, Remove GroupName attribute and use javascript to make radio buttons mutually exclusive.
For Example
function toggle(obj) {
if (obj.value == "Radio1") {
document.getElementById('ctl00_ContentPlaceHolder1_Radio2').checked = false;
}
else if (obj.value == "Radio2") {
document.getElementById('ctl00_ContentPlaceHolder1_Radio1').checked = false;
}
}
Call 'toggle(this)' on onClick event of radio buttons.
Note: 'ctl00_ContentPlaceHolder1_' is added to control id because of Content Place holder.
精彩评论