GridView上的TextBox导致点击按钮事件触发 [英] TextBox on GridView causing a button click event to fire

查看:252
本文介绍了GridView上的TextBox导致点击按钮事件触发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在追逐这一个几天,并开始让我有点慌乱。

我在Gridview上有一个文本框,允许编辑一些数据。当输入键被击中时,TextChanged事件发生,就像我所期望的那样,但它也触发了表单上按钮的OnClick事件。



我尝试过删除按钮,它只是移动到窗体上的下一个按钮,所以有一些关于这使得它认为enter键是按下按钮。



我已经试图谷歌它,但我没有看到太多。我试着在这里搜索,但似乎很不寻常,我的搜索条件没有抓住它。任何帮助或建议将是最受欢迎的。

试试设置 UseSubmitBehavior =False放在您网页上的按钮上。


I've been chasing this one around for a couple of days and it's starting to drive me a bit batty.

I have a text box on a Gridview which I'm allowing some data to be edited. When the enter key is hit, the TextChanged event happens, like I'd expect, but then it also fires the OnClick event of a button on the form.

I tried removing the button and it just moves to the next button on the form, so there's something about this that's making it think the enter key is pressing the button.

I've tried to Google it, but I'm not seeing much. I tried searching here, but it seems to be unusual enough that my search terms aren't catching it. Any help or suggestions would be most welcome.

解决方案

Try setting the UseSubmitBehavior="False" on the buttons on your page.

这篇关于GridView上的TextBox导致点击按钮事件触发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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