获取RadioButtonList 值问题
<asp:RadioButtonList ID="rblbtn" runat="server" > </asp:RadioButtonList>
<asp:Button ID="btndelte" runat="server" Text="删除" OnClientClick="return test()" onclick="btndelte_Click" />
RadioButtonList 数据源 后台动态绑定
页面加载后效果。
<tr>
<td><input id="rblbtn_0" type="radio" name="rblbtn" value="新建地址" /><label for="rblbtn_0">新建地址</label></td>
</tr><tr>
<td><input id="rblbtn_1" type="radio" name="rblbtn" value="897899978" /><label for="rblbtn_1">897899978</label></td>
</tr>
前台js 操作
function test() {
var rblbtn = document.getElementById("<%=rblbtn.ClientID %>");
var rbs = rblbtn.getElementsByTagName("input");
for (var i = 0; i < rbs.length; i++) {
var str = rbs[i].value;
if (rbs[i].checked && rbs[i].value != "新建地址") {
var st= rbs[i].value;
if (window.confirm("确定删除") == true) {
return <%=udddpdate() %>;
}
else
{
return false;
}
}