Onclick, onserverclick, onclientclick

Source: Internet
Author: User

<asp:button id=button1 runat=server test=button1 onclick=button1_onclick/><input type=button id=button2 runat=server value=button2 onserverclick=button2_onclick>
对于服务器按钮控件(即<asp:Button>类型的按钮):服务器响应事件:OnClick客户端响应属性:OnClientClick
onclientClick 先于 onClick执行对于html按钮控件(即<input type="button" runat="server">)服务器响应事件:OnServerClick客户端响应事件:onclick
onClick 先于OnServeClick执行
      <asp:button> 中有 onclick,onClientClick 属性,没有onServerClick
     <input> 中有onclick,onServerClick属性,没有onClientClick
客户端javascript先于服务器端执行。
 
onServerClick提交后会有个记忆缓存,刷新也是假刷新,所以可能发生重复提交的可能,在这里调用刷新用到如下:
this.Response.Redirect(this.Request.Url.ToString());
 
 

Onclick, onserverclick, onclientclick

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.