Hello,

I have a sample program which reads the value of asp radio button on a
button click. The radio button is disabled on a click of another asp
button.
In the code behind, when I click a button to retrieve the value of
radio button whether it is checked or unchecked it always returns me
False value (irrespective of whether it is checked or unchecked).

Please let me know in case I am doing anything wrong.

Here is my code:

<html xmlns="http://www.w3.org/1999/xhtml"; >
<head runat="server">
    <title>Untitled Page</title>
    <script type="text/javascript" language="javascript">
    function Disable()
    {
        document.getElementById("rdo").disabled = true;
    }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:RadioButton Checked="true" runat="server" ID="rdo" /
>MyRadioButton
        <br />
        <asp:Button runat="server" ID="btn" Text="Click..."
OnClick="btn_Click" />
        <br />
        <asp:Button runat="server" ID="btnDisable" Text="Disable..."
OnClientClick="Disable(); return false;"/>
        <br />
        <asp:Label runat="server" ID="lbl"></asp:Label>
    </div>
    </form>
</body>
</html>


========== Code behind:::
protected void btn_Click(object sender, EventArgs e)
        {
            lbl.Text = rdo.Checked.ToString();
        }

Thanks,
Pramod

Reply via email to