开发者

Disable default button in ASP.NET [duplicate]

开发者 https://www.devze.com 2023-04-08 08:35 出处:网络
This question already has answers here: Closed 11 years ago. Possible Duplicate: ASP.NET Canceling the Default Submit Button
This question already has answers here: Closed 11 years ago.

Possible Duplicate:

ASP.NET Canceling the Default Submit Button

I have only 1 button in my ASP.NET page 开发者_运维知识库but when I click "Enter" key the button click function is talking place. I don't want that. Only manual click must work. How to make this?


Set the button's UseSubmitBehavior = "false"


<body onkeypress="return CancelReturnKey();">

  <script type="text/javascript">
        function CancelReturnKey() {
            if (window.event.keyCode == 13)
                return false;
        }
    </script>


Please see the links

http://www.bloggingdeveloper.com/post/Disable-Form-Submit-on-Enter-Key-Press.aspx

http://forums.asp.net/t/985791.aspx/1

0

精彩评论

暂无评论...
验证码 换一张
取 消