后台代码是这样写的
RadioButton rdoTrue = new RadioButton();
RadioButton rdoFalse = new RadioButton();
rdoTrue.Text = "是";
rdoFalse.Text = "否";
rdoTrue.ID = "rdolist";
rdoFalse.ID = "rdolist";
生成的代码是
<input id="rdolist" type="radio" name="rdolist" value="rdolist" checked="checked" /><label for="rdolist">是</label><input id="rdolist" type="radio" name="rdolist" value="rdolist" /><label for="rdolist">否</label>是动态生成的
我在后台按钮点击事件中怎么取它哪个被选中了呢?
谢谢各位高手帮帮忙啊!!!!!!!!
RadioButton rdoTrue = new RadioButton();
RadioButton rdoFalse = new RadioButton();
rdoTrue.Text = "是";
rdoFalse.Text = "否";
rdoTrue.ID = "rdolist";
rdoFalse.ID = "rdolist";
生成的代码是
<input id="rdolist" type="radio" name="rdolist" value="rdolist" checked="checked" /><label for="rdolist">是</label><input id="rdolist" type="radio" name="rdolist" value="rdolist" /><label for="rdolist">否</label>是动态生成的
我在后台按钮点击事件中怎么取它哪个被选中了呢?
谢谢各位高手帮帮忙啊!!!!!!!!
在后台事件中可以用radType.SelectedValue获取选择的value<asp:RadioButtonList ID="radType" runat="server" >
<asp:ListItem Value="1">1</asp:ListItem>
<asp:ListItem Value="2">2</asp:ListItem>
</asp:RadioButtonList>
所以才要后台动态在取它的值,要是用控件那就好办了
baidu
还有你为什么不用ASP的RADIOBUTTON?放在一个GROUPNAME里,也好取文本值。
解决你问题
改掉一个ID 。判断checked属性为TRUE时该ID的REDIO选中了。
问题是控件时动态生成的,你从后台怎么得到他
在提交的时候根据 Form[Name] 就可以了