onClick和onClientClick之间的差异 [英] differences between onClick and onClientClick

查看:103
本文介绍了onClick和onClientClick之间的差异的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





任何人都可以解释onClick和onClientClick,我也想知道它们之间的差异。



还有一个疑问是,onClick Clientside事件还是服务器端事件?

Hi,

Can anyone explain about onClick and onClientClick, I also want to know the differences between them.

One more doubt is, Is onClick Clientside event or Server side event?

推荐答案

1.On Click事件将请求发送到服务器并作为响应执行操作。

2.在客户端点击非常类似于onclick函数,我们用它来编写Javascript ...即它在客户端执行语句而不将其发送到服务器



谢谢

www.alacraft.com。 au
1.On Click Event sends the request to the server and in response performs the action.
2. On Client Click is very similar to onclick function which we use to write in Javascript... that is it executes the statements in the client side with out sending it to the server

Thanks
www.alacraft.com.au


OnClick 将在服务器端工作, OnClientClick 将在控制传递给服务器之前在客户端执行。

如果客户端代码返回 TRUE ,那么它将转到服务器。

通常程序员使用 onClientClick 来验证控件,如文本框等。

Button / LinkBut​​ton / ImageButton控件asp.net 2.0及更多版本具有 OnClientClick 属性。这基本上是属性[onclick] 的快捷方式,允许你这样做:



OnClick will work on server side , OnClientClick will execute on client side before control passed to server.
If the client side code returns TRUE then it will go to server.
Generally programmers use onClientClick to validate the controls like textbox,etc.
The Button/LinkButton/ImageButton controls in asp.net 2.0 and more have a OnClientClick property. This is basically a shortcut for Attributes["onclick"] allowing you to do:

Button1.OnClientClick = "alert('foo');";


OnClientClick用于在客户端进行事件处理,而OnClick用于服务器端的hadle事件。
OnClientClick is used to hadle the event at client side whereas OnClick is used to hadle event on server side.


这篇关于onClick和onClientClick之间的差异的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆