Jump to content

radiobutton onclick

Recommended Posts

Is there a way to tie a radiobutton into a function? Like onClick?


I've looked on msdn, but the closest I found is OnCheckedChanged and that isn't working for me. This is what I've tried.

    <asp:RadioButton ID="radSpecifyOther" runat="server" GroupName="specify" Text="Other" OnCheckedChanged="radEnableOther" EnableViewState="true"/>    protected void radEnableOther(object sender, EventArgs e)    {        if (radSpecifyOther.Checked)        txtEnableSpecify.Enabled = true;        else txtEnableSpecify.Enabled = false;    }
Edited by Emwat Oon
Link to post
Share on other sites
  • 5 years later...

Yes you can use onclick event as

 <asp:RadioButton ID="chkNo" Text="No" runat="server" onclick="fn()" />

you can add your own function.

After this you can use the JavaScript to define function.

<script type="text/javascript">
        function fn() {
            alert("I have clicked no button");

i hope you will understand.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...