简体   繁体   中英

Radio button cant be clicked/checked

i am trying to use radio buttons using asp.net which are in a container but if i select the right radio button, the left radio button becomes checked, even though i clicked the right one.

this is my code:

<asp:RadioButton ID="rdoSmallJars" Text="Small" runat="server" GroupName="measurementSystem" style="z-index: 1; left: 350px; top: -440px; position: absolute; height: 21px;" AutoPostBack="True"/>

<asp:RadioButton ID="rdo1" Text="Test" runat="server" GroupName="measurementSystem" style="z-index: 1; left: 450px; top: -440px; position: absolute; height: 21px;" AutoPostBack="True" />

any ideas? thank you

You need to give each radio button a Value. If you don't they will both have the same default Value and clicking on either of them will be equivalent to clicking on the first one with the value.

eg:

<asp:RadioButton Value="1" ID="rdoSmallJars" Text="Small" runat="server" GroupName="measurementSystem" style="z-index: 1; left: 350px; top: -440px; position: absolute; height: 21px;" AutoPostBack="True"/>

<asp:RadioButton Value="2" ID="rdo1" Text="Test" runat="server" GroupName="measurementSystem" style="z-index: 1; left: 450px; top: -440px; position: absolute; height: 21px;" AutoPostBack="True" />

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM