文本框自动返回问题 [英] problem with text box auto back

查看:71
本文介绍了文本框自动返回问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,

我有一个文本框和日历扩展程序控件.
当我选择文本框时,日历控件将正确显示.但是,如果每当光标位于文本框中时,只要按键盘上的Enter键,页面都会回发并注销.

如果有人知道,请帮助我.

谢谢.

Hello,

I have a textbox and calendar extender control.
When I select the textbox, the calendar control is displaying properly. But, if I press enter button on the keyboard whenever the cursor is in the textbox the page will postback and signout.

If anybody knows, please help me.

thanking you.

推荐答案

Sathish!

试试这个:

Hi Sathish!

Try this:

<asp:TextBox ID="TextBox1" runat="server"



   onkeydown = "return (event.keyCode!=13);" >

</asp:TextBox>



该解决方案由Mudassar Khan在www.aspsnippets.com上提供
效果是当在文本框中并按Enter键时,它将被忽略,因为该函数返回false.

干杯

Manfred



This solution was provided by Mudassar Khan on www.aspsnippets.com
The effect is that when being in the textbox and hitting the enter key, it will be ignored because the function returns false.

Cheers

Manfred


您的表单上可能有几个提交按钮.

按Enter键时,它可能会模拟错误的按钮.

尝试为您的
上的默认提交按钮定义适当的按钮 Page_OnLoad事件:
You may have several submit buttons on you form.

When pressing enter key, it might simulate the wrong button.

Try to define the proper button for the default submit button on your
Page_OnLoad event:
this.form1.DefaultButton=btnMyDefaultButton.ClientID;


这篇关于文本框自动返回问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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