ASP.NET文本框框TextChanged和按钮的OnClick事件的互动? [英] ASP.NET Textbox TextChanged and Button OnClick event interaction?

查看:185
本文介绍了ASP.NET文本框框TextChanged和按钮的OnClick事件的互动?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经得到了我通过谷歌浏览器访问的ASP.NET应用程序。在一个特定的页面我有一个asp:TextBox控件以及一个重新计算页面上的其他一些字段OnTextChanged事件。我也得到了一个asp:LinkBut​​ton的与将更改保存到数据库中onclick事件

I've got an ASP.NET application that I'm accessing through Google Chrome. On a particular page I've got an asp:TextBox with a OnTextChanged event that recalculates a few other fields on the page. I've also got an asp:LinkButton with an OnClick event that saves the changes to the database.

我面临当用户点击保存按钮左侧的TextBox的一个问题。这样的变化并没有正在保存拍摄的按钮被TextChanged事件之前发射。我通过在保存方法的开头复制框TextChanged逻辑解决了这个问题。做了一些测试之前,我犯了这些变化,一切都正常工作。

I was facing a problem where the user left the TextBox by clicking on the save button. The button was firing before the TextChanged event so the changes were not being captured in the save. I fixed this by duplicating the TextChanged logic at the beginning of the save method. Did some testing before I committed these changes and everything was working fine.

但现在我的测试车正面临着不同的问题。当他改变了文本字段,并点击保存按钮,该OnTextChanged事件被触发到页面上更新其他值,但为保存按钮OnClick事件在不触发的。他点击保存按钮,第二次获得onclick事件触发。我测试了我的机器上相同的功能,它仍然为我工作的罚款。我和他在具有相同的数据库中的相同环境寻找以完全相同的页面。我有我的测试清除他的缓存等等。我能找到的唯一区别是,我的Chrome版本为14.0.835.202 M,而他简直是14.0.835.202。

But now my tester is facing a different problem. When he changes the text field and clicks the save button, the OnTextChanged event is firing to update the other values on the page but the OnClick event for the save button is not firing at all. He has to click the save button a second time to get the OnClick event to fire. I tested the same functionality on my machine and it's still working fine for me. He and I are looking at exactly the same page in the same environment with the same database. I had my tester clear his cache etc. The only difference I can find is that my Chrome version is "14.0.835.202 m" while his is simply "14.0.835.202".

是否有与Chrome和ASP.NET在这里激发事件可以是非确定性的东西或任何已知问题?任何人有,为什么这可能发生的任何其他的想法?感谢您的时间!

Are there any known issues with Chrome and ASP.NET where event firing can be non-deterministic or something? Anyone have any other idea why this might be happening? Thanks for your time!

推荐答案

我相信这是一个已知的问题。

I believe this is a known issue.

一个选项是禁用按钮(客户端),当用户在文本框输入,而框TextChanged 事件完成后启用它。

One option is to disable the button (client-side) when the user is typing in the TextBox, and enable it after the TextChanged event completes.

另一种方法是删除的AutoPostBack =真正的和使用A​​JAX来代替。

Another option is to remove AutoPostBack="true" and use AJAX instead.

这篇关于ASP.NET文本框框TextChanged和按钮的OnClick事件的互动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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