Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Can't use enter on asp.net form

Reply
Thread Tools

Can't use enter on asp.net form

 
 
=?Utf-8?B?TSBL?=
Guest
Posts: n/a
 
      09-03-2004
I have a web form with a listbox and single text box and a single button.
When my users type in the text box and press enter, it doesn't submit. It
refreshes the page and clears the textbox.

Any ideas?
 
Reply With Quote
 
 
 
 
Hermit Dave
Guest
Posts: n/a
 
      09-03-2004
yeah submit is done by onclick of a button or a hyperlink. enter doesnt do
the job (as event args need to be populated with right info so what happens
is it just does a page_load and comes back) and what i tend to do is disable
it altogether.

--

Regards,

Hermit Dave
(http://hdave.blogspot.com)
"M K" <> wrote in message
news:16EF1347-C934-443E-A316-...
> I have a web form with a listbox and single text box and a single button.
> When my users type in the text box and press enter, it doesn't submit. It
> refreshes the page and clears the textbox.
>
> Any ideas?



 
Reply With Quote
 
 
 
 
Steven Cheng[MSFT]
Guest
Posts: n/a
 
      09-04-2004
Hi Mark,

Hermit's suggstion is reasonable. The ASP.NET webform need some control to
fire the post back event and not all the controls can fire such event by
default. The "submit button" , "link button" 's click can by default make
the page post back to server. So you need to add a button on the web form
page to let the user post back the page.

In addition, here are some referernce in MSDN on the asp.net's page model
and control events:

#Introduction to ASP.NET and Web Forms
http://msdn.microsoft.com/library/de...us/dndotnet/ht
ml/introwebforms.asp

#Events in ASP.NET Server Controls
http://msdn.microsoft.com/library/de...us/cpguide/htm
l/cpconeventsinwebformscontrols.asp

Hope helps.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

 
Reply With Quote
 
=?Utf-8?B?TSBL?=
Guest
Posts: n/a
 
      09-07-2004
I have a button. But many users are used to pressing the enter key after
keying in a password.

"Steven Cheng[MSFT]" wrote:

> Hi Mark,
>
> Hermit's suggstion is reasonable. The ASP.NET webform need some control to
> fire the post back event and not all the controls can fire such event by
> default. The "submit button" , "link button" 's click can by default make
> the page post back to server. So you need to add a button on the web form
> page to let the user post back the page.
>
> In addition, here are some referernce in MSDN on the asp.net's page model
> and control events:
>
> #Introduction to ASP.NET and Web Forms
> http://msdn.microsoft.com/library/de...us/dndotnet/ht
> ml/introwebforms.asp
>
> #Events in ASP.NET Server Controls
> http://msdn.microsoft.com/library/de...us/cpguide/htm
> l/cpconeventsinwebformscontrols.asp
>
> Hope helps.
>
> Regards,
>
> Steven Cheng
> Microsoft Online Support
>
> Get Secure! www.microsoft.com/security
> (This posting is provided "AS IS", with no warranties, and confers no
> rights.)
>
>

 
Reply With Quote
 
Steven Cheng[MSFT]
Guest
Posts: n/a
 
      09-08-2004
Hi Mark,

Thanks for the followup. Based on your further description, I think this is
a normal behavior of the web page. The asp.net page didn't have the
"default button" feature(which exist in windows form application) by
default.

As for how to make a Button control as the default button on a asp.net
webform page, there is no buildin means for setting default button. We can
use javascript code to let a certain button be clicked when we press
"enter" key on a textbox. Here are some tech articles and former threads
discussing on the same question:


http://www.kamp-hansen.dk/pages/show...d=21&menuid=18

http://www.metabuilders.com/tools/DefaultButtons.aspx

http://www.allasp.net/enterkey.aspx


http://groups.google.com/groups?hl=e...tFHT8DHA.1152%
40cpmsftngxa07.phx.gbl&rnum=1&prev=/groups%3Fhl%3Den%26lr%3D%26ie%3DUTF-8%26
q%3Denter%2Bkey%2Bsteven%2Bcheng

Hope helps. Thanks.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)


 
Reply With Quote
 
=?Utf-8?B?TSBL?=
Guest
Posts: n/a
 
      09-08-2004
Thanks. Setting the Event Target worked. That's all I needed.

"Steven Cheng[MSFT]" wrote:

> Hi Mark,
>
> Thanks for the followup. Based on your further description, I think this is
> a normal behavior of the web page. The asp.net page didn't have the
> "default button" feature(which exist in windows form application) by
> default.
>
> As for how to make a Button control as the default button on a asp.net
> webform page, there is no buildin means for setting default button. We can
> use javascript code to let a certain button be clicked when we press
> "enter" key on a textbox. Here are some tech articles and former threads
> discussing on the same question:
>
>
> http://www.kamp-hansen.dk/pages/show...d=21&menuid=18
>
> http://www.metabuilders.com/tools/DefaultButtons.aspx
>
> http://www.allasp.net/enterkey.aspx
>
>
> http://groups.google.com/groups?hl=e...tFHT8DHA.1152%
> 40cpmsftngxa07.phx.gbl&rnum=1&prev=/groups%3Fhl%3Den%26lr%3D%26ie%3DUTF-8%26
> q%3Denter%2Bkey%2Bsteven%2Bcheng
>
> Hope helps. Thanks.
>
> Regards,
>
> Steven Cheng
> Microsoft Online Support
>
> Get Secure! www.microsoft.com/security
> (This posting is provided "AS IS", with no warranties, and confers no
> rights.)
>
>
>

 
Reply With Quote
 
=?Utf-8?B?bWF2cmlja18xMDE=?=
Guest
Posts: n/a
 
      03-21-2006
Hi,

Can you share what you did?

Thnx


"M K" wrote:

> Thanks. Setting the Event Target worked. That's all I needed.
>
> "Steven Cheng[MSFT]" wrote:
>
> > Hi Mark,
> >
> > Thanks for the followup. Based on your further description, I think this is
> > a normal behavior of the web page. The asp.net page didn't have the
> > "default button" feature(which exist in windows form application) by
> > default.
> >
> > As for how to make a Button control as the default button on a asp.net
> > webform page, there is no buildin means for setting default button. We can
> > use javascript code to let a certain button be clicked when we press
> > "enter" key on a textbox. Here are some tech articles and former threads
> > discussing on the same question:
> >
> >
> > http://www.kamp-hansen.dk/pages/show...d=21&menuid=18
> >
> > http://www.metabuilders.com/tools/DefaultButtons.aspx
> >
> > http://www.allasp.net/enterkey.aspx
> >
> >
> > http://groups.google.com/groups?hl=e...tFHT8DHA.1152%
> > 40cpmsftngxa07.phx.gbl&rnum=1&prev=/groups%3Fhl%3Den%26lr%3D%26ie%3DUTF-8%26
> > q%3Denter%2Bkey%2Bsteven%2Bcheng
> >
> > Hope helps. Thanks.
> >
> > Regards,
> >
> > Steven Cheng
> > Microsoft Online Support
> >
> > Get Secure! www.microsoft.com/security
> > (This posting is provided "AS IS", with no warranties, and confers no
> > rights.)
> >
> >
> >

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
hitting enter or shift+enter in asp.net designer messes up html code? Sunfire ASP .Net 2 11-06-2007 02:44 PM
How to disable imagebutton postback when i enter "enter" =?Utf-8?B?am9l?= ASP .Net 0 09-28-2006 06:46 AM
capturing from text area Shft+Enter, Control+Enter, Alt+Enter and browser issue. HopfZ Javascript 0 08-28-2006 10:11 AM
Enter Key H*ll, control enter key submit button BrianDH ASP .Net Web Controls 3 01-12-2005 08:29 PM
trigger HTML button by enter ENTER key Matt Javascript 1 03-06-2004 07:01 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57