Click here to Skip to main content
16,006,786 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
please provide me the answer of my question

using simple asp.net
using java script
using jquery


thanks
Posted
Comments
Sunil_Nikam 26-Mar-14 11:51am    
Please clarify, you want to disable or unselect the other radio button
Radio button share the same name-property, hence click on on unselect the others

To disable (to gray out) you can use jquery as below
Let's presume the name of the radio button group is 'a1'
$("input[name='a1']").click(function(){
    $("input[name='a1']").attr('disabled', true);
    $(this).attr('disabled', false);
});
 
Share this answer
 
What you need is RadioButtonList[^]
 
Share this answer
 
 
Share this answer
 
For ASP.Net:

ASPX file:

XML
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="WebApplicationRnD.WebForm1" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:RadioButton Text="Radio1" GroupName="rad" runat="server"  ID="radio1"
            AutoPostBack="True" oncheckedchanged="radio_CheckedChanged" />
        <asp:RadioButton Text="Radio2" GroupName="rad" runat="server"  ID="radio2"
            AutoPostBack="True" oncheckedchanged="radio_CheckedChanged" />
        <asp:RadioButton Text="Radio3" GroupName="rad" runat="server"  ID="radio3"
            AutoPostBack="True" oncheckedchanged="radio_CheckedChanged" />
    </div>
    </form>
</body>
</html>



C# Code(Code Behind):

C#
namespace WebApplicationRnD
{
    public partial class WebForm1 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void radio_CheckedChanged(object sender, EventArgs e)
        {
            radio1.Enabled = false;
        }

       
    }
}


Thanks.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900