取消默认的ASP.NET提交按钮 [英] Canceling the default submit button in ASP.NET

查看:235
本文介绍了取消默认的ASP.NET提交按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个ASP.NET应用程序,其中有几个ASP.NET按钮和几个简单的HTML按钮。每当有一个文本框,其中用户点击进入后,ASP.NET按钮尝试提交表单。

I have an ASP.NET application where there's a few ASP.NET buttons and several plain HTML buttons. Anytime there's a textbox where a user hits enter, the ASP.NET button tries to submit the form.

我知道我可以修改 defaultButton ,但我不希望有任何默认按钮。我只是希望它这样,当用户presses进入它不会做任何事情。

I know I can change the defaultButton, but I don't want there to be any default button. I just want it so when the user presses enter it doesn't do anything.

我试过设置 defaultButton 为空,但似乎并没有工作。我如何prevent被提交按钮ASP.NET表单中输入的pressed什么时候?

I've tried setting defaultButton to blank, but that doesn't seem to work. How do I prevent the form from being submitted by the ASP.NET button when enter is pressed?

推荐答案

您可以设置按钮的UseSubmitBehavior =FALSE

You can set the button's UseSubmitBehavior = "false"

这篇关于取消默认的ASP.NET提交按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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