[英]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. 我正在尝试使用位于容器中的asp.net使用单选按钮,但是如果我选择了右单选按钮,即使单击了右单选按钮,左单选按钮也会被选中。
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" />
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.