Jump to content
Sign in to follow this  
Emwat Oon

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

Share this post


Link to post
Share on other sites

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");
        }
    </script>

i hope you will understand.

Share this post


Link to post
Share on other sites

Please do not reply to old topics.

Share this post


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.

Guest
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.

Loading...
Sign in to follow this  

×
×
  • Create New...