简体   繁体   中英

Asp.net buttons event click without do postback. Is it possible?

I would like to know if is possible to use a asp:button , use an event click. and call a javascript instead code behind without to do postback? I need to record voice and I´m using javascript to do this. Someone could help me?

You could create your button and use the OnClientClick Property in this way:

<asp:Button runat="server" Text="Click me" OnClientClick="myFunction(); return false;" />

With that you call myFunction(); and the return false; prevent the __doPostBack function will be called avoiding the postback.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM