按钮点击事件在asp.net中提升 [英] Button click event is raising in asp.net

查看:64
本文介绍了按钮点击事件在asp.net中提升的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

全部好,



我有文本框和按钮。每当我在文本框中输入内容并单击回车时,按钮的按钮点击事件就会提高。我对它的工作方式有疑问。请澄清。

HI all,

I have textbox and button.So whenever i type something in textbox and click enter ,button click event of button is raising. I have doubt in the way it is working.Please clarify.

推荐答案

如果你的输入类型是提交,它会引发onlick事件,你可以改变它按钮以防止这种情况发生。



你可以在这里试试。

http://www.w3schools.com/html/tryit.asp? filename = tryhtml_form_submit [ ^ ]
If your input type is "submit", it will raise the onlick event, you can change it to button to prevent this from happening.

You can try it here.
http://www.w3schools.com/html/tryit.asp?filename=tryhtml_form_submit[^]


嗨Dileepc,



对于每个页面或面板都有一个默认按钮,在你的情况下,虽然焦点是文本框如果您按Enter键,则会触发默认按钮单击事件。如果您想避免它,这是一个常规过程,您可以在onkeydown事件中编写一些JavaScript代码。



如果这是您期望的,请告诉我。 />


干杯,

Sai
Hi Dileepc,

For every page or panel there will be a default button, in your case though focus is on text box if u press enter, the default button click event fires. That is a regular process if you want to avoid it, u can write some JavaScript code in onkeydown event.

Let me know if this is what u r expecting.

Cheers,
Sai


这篇关于按钮点击事件在asp.net中提升的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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