Redian新闻
>
how to let button response 'return' key?
avatar
how to let button response 'return' key?# DotNet - 窗口里的风景
G*T
1
I'm using ASP.net to design a simple webpage: a textbox and a button. After
the user inputs in the textbox, the user can click the button. The aspx will
show some select results from database. I'm not familar with asp/asp.net, my
question is: how to let the button response if the user just uses keyboard and
key_down the 'return' key? In VB.net, it has the corresponding event, but I
can not find it in this webform. What I should do?
thanks
avatar
G*o
2
it is he same as button_click
you don't have to define an extra event to handle this situation

【在 G**T 的大作中提到】
: I'm using ASP.net to design a simple webpage: a textbox and a button. After
: the user inputs in the textbox, the user can click the button. The aspx will
: show some select results from database. I'm not familar with asp/asp.net, my
: question is: how to let the button response if the user just uses keyboard and
: key_down the 'return' key? In VB.net, it has the corresponding event, but I
: can not find it in this webform. What I should do?
: thanks

avatar
r*y
3
One way, may not the best, but may be general:
Creating a default button for the page
It is usual for a web form to have more than one button control. How can you
set the default button that should submit the form and raise its Click event
on the server when the enter key is pressed on the form? The textbox and the
other input controls don't have a property that allow you to specify such a
default button. The answer is in a simple client-side javascript function
called whenever a button is press
avatar
G*T
4

Thanks.
Enter
and
After
will
my
and
I

【在 r****y 的大作中提到】
: One way, may not the best, but may be general:
: Creating a default button for the page
: It is usual for a web form to have more than one button control. How can you
: set the default button that should submit the form and raise its Click event
: on the server when the enter key is pressed on the form? The textbox and the
: other input controls don't have a property that allow you to specify such a
: default button. The answer is in a simple client-side javascript function
: called whenever a button is press

avatar
r*y
5
also check this link for another way:
http://www.allasp.net/enterkey.aspx

【在 G**T 的大作中提到】
:
: Thanks.
: Enter
: and
: After
: will
: my
: and
: I

avatar
G*T
6

NX ya
thanks again.
you
event
the
such a
function
button.
pages,
page
specified
function
event,

【在 r****y 的大作中提到】
: also check this link for another way:
: http://www.allasp.net/enterkey.aspx

avatar
k*i
7
There is already a user sample in gotdotnet which have a base webpage that you
can inherit and handle all the magic for you
【 在 GTGT (玩) 的大作中提到: 】
and
相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。