Friday, November 22, 2013

get the value from radiobuttonlist through javascript asp.net

<form runat="server">
<asp:RadioButtonList ID="RadioButtonList1" runat="server" 
          RepeatDirection="Horizontal" RepeatLayout="flow" >
         <asp:ListItem Selected="True" Text ="Yes" Value="0"></asp:ListItem>
         <asp:ListItem  Text ="No" Value="1"></asp:ListItem>
      </asp:RadioButtonList>    </form>
<p id="button" onclick="getvalue()">click me</p> 
 
<script type="text/javascript">
function getvalue(){
 alert($('#<%=RadioButtonList1.ClientID %> input[type=radio]:checked').val());
}
</script>

No comments:

Post a Comment

Complete Authentication System in ASP.NET Core using JWT

JWT (JSON Web Token) authentication is widely used for securing APIs in modern applications. In this article, we will build a complete authe...