admin管理员组文章数量:1331937
I have a Radio button in a Gridview and when we click on the button, i'm calling function in the code behind file(user control). Before that i need to implement need call a javascript function to confirm about change. I tried onclick, OnClientClick, OnSelect and none of them worked as expected.
<asp:RadioButton ID="ratiobuttonChoose" runat="server" AutoPostBack="true"
OnCheckedChanged="Selected"/>
Can someone, please suggest me how to do this one.
I have a Radio button in a Gridview and when we click on the button, i'm calling function in the code behind file(user control). Before that i need to implement need call a javascript function to confirm about change. I tried onclick, OnClientClick, OnSelect and none of them worked as expected.
<asp:RadioButton ID="ratiobuttonChoose" runat="server" AutoPostBack="true"
OnCheckedChanged="Selected"/>
Can someone, please suggest me how to do this one.
Share edited Sep 15, 2015 at 2:30 zed 2,3384 gold badges28 silver badges45 bronze badges asked Sep 14, 2015 at 23:18 user4872443user4872443 2- 2 I've read in SO that onclick works – Jaromanda X Commented Sep 14, 2015 at 23:25
- 1 It's not case sensitive is it? onClick? – Mathemats Commented Sep 14, 2015 at 23:27
1 Answer
Reset to default 6Add a script on Page_Load in code behind:
ratiobuttonChoose.Attributes.Add("onclick", "clientJsFunction()");
Reference: MSDN
You can add onclick direct on your tag (VisualStudio don't suggest but it works):
<asp:RadioButton ID="ratiobuttonChoose" runat="server" AutoPostBack="true"
OnCheckedChanged="Selected" onclick="alert('Clicked!');" />
You can also use jQuery, see here.
本文标签: cHow to Call Javascript function in aspRadiobuttonStack Overflow
版权声明:本文标题:c# - How to Call Javascript function in asp:Radiobutton? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742261078a2442524.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论