通过在文本框中按Enter键获取e.keychar(按回车键) [英] get e.keychar with press enter in a textbox(with press enter)

查看:598
本文介绍了通过在文本框中按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.


这篇关于通过在文本框中按Enter键获取e.keychar(按回车键)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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