首页 > 技术文章 > C# 服务端控件 asp:RadioButton 选择选中值

zhengwei-cq 2018-09-05 08:22 原文

1、服务端控件RadioButton

<asp:RadioButton ID="rbNewUser" runat="server" GroupName="user" Text="新用户注册"  />
<asp:RadioButton ID="rbExistUser" runat="server" GroupName="user" Text="已有用户注册"/>

选择选中的文本

var registType = $j("input[type='radio']:checked").next().text();

 2、服务端控件RadioButton另一种获取选中的值

 <asp:RadioButtonList ID="rb_IsPublicPlan" runat="server"
                            RepeatColumns="5" RepeatDirection="Horizontal" RepeatLayout="Flow" CssClass="formradio">
                            <asp:ListItem Value="0">不公示</asp:ListItem>
                            <asp:ListItem Value="1">公示</asp:ListItem>
                        </asp:RadioButtonList>

选择选中的文本

$('#<%=rb_IsPublicPlan.ClientID%>').find('input:checked').val();

 

推荐阅读