0

I know some will ask why i am not using asp.net html controls and others will say that I should use asp.net controls, but my question is about how to do this using plain old html controls.

If I have the following:

<INPUT runat="server" type="radio" name="radio" id="radio0">Radio Button 0
<br>
<INPUT runat="server" type="radio" name="radio" id="radio1">Radio Button 1

where the user selects one of these radio buttons, so it should be a client side selection. Is it possible for me (asp.net at the server) to determine which radio button has been selected when the user submits the form?

I need the server to be able to determine this, so it can do an action based on the radio button selected.

4

2 回答 2

1

我不知道 asp.net 但通常你会为你的单选按钮添加一个值。

<input runat="server" type="radio" name="radio" id="radio0" value="0"> Radio Button 0
<br>
<input runat="server" type="radio" name="radio" id="radio1" value="1"> Radio Button 1

提交表单将返回 name 属性参数的选定单选按钮值(在本例中,您将其命名为radio)。

于 2013-06-05T15:15:51.043 回答
0

.Checked您可以使用该属性确定在服务器端选择了哪个单选按钮。

radio0.Checked;
于 2013-06-05T15:16:24.607 回答