ASP.NET Click()事件在第二次回发时不会触发 [英] ASP.NET Click() event doesn't fire on second postback

查看:131
本文介绍了ASP.NET Click()事件在第二次回发时不会触发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个ASP.NET Web表单。我第一次提交表单时,会引发SubmitButton_Click事件。



表单返回给浏览器,带有验证错误,或者可以使用新值再次提交表单。



当表单再次计数时,SubmitButton_Click事件永远不会触发。有人知道为什么我会在服务器端看到这种行为?





(我正在使用jQuery和验证控制客户端,但我不认为这是一个问题,以为我会提到它)。



编辑

 < asp:Button ID =SubmitButtonOnClick =SubmitButton_Click
runat =server/>

事件在控件上设置,而不是代码中。

解决方案

JQuery是否提交表单?如果客户端没有调用 __ doPostBack(),那么服务器端事件不会发生。


I have a ASP.NET web form. The first time I submit the form, the SubmitButton_Click event is raised.

The form is returned to the browser either with validation errors or with the option to submit the form again with new values.

When the form is sumbitted again, the SubmitButton_Click event never fires. Page_Load fires, but not the button.

Does anyone know why I would be seeing this behavior on the server side?

(I am using jQuery and the validation control client-side but I don't think it is causing an issue. Thought I would mention it anyway).

Edit:

<asp:Button ID="SubmitButton" OnClick="SubmitButton_Click"
      runat="server" />

Event is set on the control, not in code.

解决方案

Is the JQuery submitting the form? If __doPostBack() isn't called on the client side (with the approprate arguements), the server side event won't occure.

这篇关于ASP.NET Click()事件在第二次回发时不会触发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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