通过在文本框中按Enter键获取e.keychar(按回车键)
我的网络表单中有一个textbox_Search
i想要当我按下这个txtbox重定向到其他页面
i想要重定向到其他webform并按下输入
和textbox_search.text转到sesseion。
获取e.keycode或e.keychar
i只需要一个C#代码
C#
C#
i在我的网页中有一个txtbox(搜索txt)
i当我按一个键时想要
如果是这样的话键是输入(按回车键)
重定向到另一个webform
例如;
在这个站点(codeproject)
$ b $ t在txt(搜索网站)输入文本时(右上角)如果按回车
网站转到另一页并显示搜索结果
i想要这个动作
a想知道什么时候输入密钥
i have a textbox_Search in my webform
i want when i press Enter this txtbox redirect to other page
i want redirect to other webform with press enter
and textbox_search.text go to sesseion .
get e.keycode or e.keychar
i want only a C# code
C#
C#
i have a txtbox(search txt) in my webform
i want when i press a key
if that key is enter(press enter)
redirect to another webform
for example ;
in this site(codeproject)
when enter a text in txt (search site)(on top right) and if press enter
site go to another page and show search resault
i want accour this action
a want know when key is enter
我认为你想要做的是获取字符串值而不是Keys值。只需使用ToString()。
如果你想要一个KeyDown特定的密钥检查其中一个密钥枚举:
I think that what you want to do is get the string value instead of the Keys value. Just use ToString().
If you want a particular key with the KeyDown check against one of the Keys enumeration:
if (e.KeyChar == Keys.Enter)
我有一个txtbox(搜索txt )在我的网络表单中,我想按下一个键,如果输入该键(按回车键)重定向到另一个网络表单
根据您给SA的评论,您需要提交按钮默认关注它。在ASP.NET中,它被称为默认按钮
参考:
ASP.NET DefaultButton属性 [ ^ ]
默认按钮的示例用法 [ ^ ]
不需要任何密钥代码。使用上面的内容,输入press的默认行为会将其定义为为该按钮单击定义。
i have a txtbox(search txt) in my webform i want when i press a key if that key is enter(press enter) redirect to another webform
Based on the comment given by you to SA, you need a submit button with default focus on it. In ASP.NET, it's termed as "Default Button"
Refer:
ASP.NET DefaultButton Property[^]
Sample usage of Default button[^]
No need of any key code or so. Using above, default behavior of enter press would direct it as defined for that button click.