Enter Key Postback

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a web form that is a child of a Master Page. It is a login form for
forms authentication.

When you fill in the username and password box and press ENTER it doesnt
process any of the VB.NET code it sits there doing nothing.

I've tried some of the solutions on the internet but they don't work - I
think it might have something to do with the fact I'm using a Master Page...?

PLEASE HELP! This is driving me nuts!!

Andrew.
 
Hi Andrew,

Welcome to ASPNET newsgroup.
From your description, one of your login page(ASP.NET2.0) which created
from a MasterPage didn't handle the login button's submit event correctly
,ye s?

Based on my understanding, when we enter "enter" key on a web page (at
lease in IE), the first submit button on the page will be clicked so as to
submit the page. So If you found the page's login code not execute
correctly, it must be the page didn't be submit correctly. Is it working
correctly if we manually click that submit button?
also, as you mentioned that you've tried applying some tips on the
internet, would please paste some of those code snippets so that we can
have a further investigate here?

Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
Thanks for your message. I've created an 'Experts-Exchange' post for this and
I've pasted all the HTML and ASP.NET code into it ... if you take a look at
the following link I hope it will give you what you're after:

http://www.experts-exchange.com/Web/Web_Languages/ASP/Q_21466176.html#14271172

I've tried putting a invisible HTML textbox in the login page's code as per
a fix on a website, but i still get the same problem. If I CLICK the Submit
button it all works fine, it's just when I press the enter key when the focus
is in the password box does it NOT work.

The textboxes and submit button are all ASP controls running server-side (as
opposed to HTML controls)

Thanks in advance!!
Andrew.
 
Thanks Andrew,

I'll follow the link you provided and have a look.

Steven Cheng
Microsoft Online Support

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

Seems I can't get the detailed code snippet from the
http://www.experts-exchange.com/

Do I need to sign on that site? Anyway, I'd appreciate if you can paste the
code snippet here.

Thank you,

Steven Cheng
Microsoft Online Support

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

I have the exact same issue when using one textbox in a form with a submit
button, mouse clicking the button causes proper postback and event handling,
but enter key looks like it does the postback but doesn't trigger events.
This also only seems to be an IE bug???

The only workaround/fudge I have that consistently works is NOT to use the
buttons OnClick event, but to call the handling method from the top of the
PreRender of the page, only when the page is in postback, i.e. (vb example)

Sub Page_PreRender(sender As Object, e As EventArgs)
If Page.IsPostBack() Then
' Call the login event handler this way rather than on an OnClick
' button event to get around IE bug with only one textbox in form
ProcessSubmit()
End If
...
End Sub

Sub ProcessSubmit()
'event handling code exactly as in btnButton_Click() handler
...
End Sub


Now this is really only viable if there is one form and one submit button on
the page, otherwise you'll end up with all sorts of extra problems :O)

Looking forward to any other comments on this issue.

Cheers

Chris

Andrew Willett said:
Thanks for your message. I've created an 'Experts-Exchange' post for this
and
I've pasted all the HTML and ASP.NET code into it ... if you take a look
at
the following link I hope it will give you what you're after:

http://www.experts-exchange.com/Web/Web_Languages/ASP/Q_21466176.html#14271172

I've tried putting a invisible HTML textbox in the login page's code as
per
a fix on a website, but i still get the same problem. If I CLICK the
Submit
button it all works fine, it's just when I press the enter key when the
focus
is in the password box does it NOT work.

The textboxes and submit button are all ASP controls running server-side
(as
opposed to HTML controls)

Thanks in advance!!
Andrew.

"WenJun Zhang[msft]" said:
Hi Andrew,

Welcome to ASPNET newsgroup.
From your description, one of your login page(ASP.NET2.0) which created
from a MasterPage didn't handle the login button's submit event correctly
,ye s?

Based on my understanding, when we enter "enter" key on a web page (at
lease in IE), the first submit button on the page will be clicked so as
to
submit the page. So If you found the page's login code not execute
correctly, it must be the page didn't be submit correctly. Is it working
correctly if we manually click that submit button?
also, as you mentioned that you've tried applying some tips on the
internet, would please paste some of those code snippets so that we can
have a further investigate here?

Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
Don't forget to add "Handles MyBase.PreRender" to "Sub Page_PreRender(sender
As Object, e As EventArgs)"


Chris Gill said:
Hi,

I have the exact same issue when using one textbox in a form with a submit
button, mouse clicking the button causes proper postback and event handling,
but enter key looks like it does the postback but doesn't trigger events.
This also only seems to be an IE bug???

The only workaround/fudge I have that consistently works is NOT to use the
buttons OnClick event, but to call the handling method from the top of the
PreRender of the page, only when the page is in postback, i.e. (vb example)

Sub Page_PreRender(sender As Object, e As EventArgs)
If Page.IsPostBack() Then
' Call the login event handler this way rather than on an OnClick
' button event to get around IE bug with only one textbox in form
ProcessSubmit()
End If
...
End Sub

Sub ProcessSubmit()
'event handling code exactly as in btnButton_Click() handler
...
End Sub


Now this is really only viable if there is one form and one submit button on
the page, otherwise you'll end up with all sorts of extra problems :O)

Looking forward to any other comments on this issue.

Cheers

Chris

Thanks for your message. I've created an 'Experts-Exchange' post for this
and
I've pasted all the HTML and ASP.NET code into it ... if you take a look
at
the following link I hope it will give you what you're after:

http://www.experts-exchange.com/Web/Web_Languages/ASP/Q_21466176.html#14271172

I've tried putting a invisible HTML textbox in the login page's code as
per
a fix on a website, but i still get the same problem. If I CLICK the
Submit
button it all works fine, it's just when I press the enter key when the
focus
is in the password box does it NOT work.

The textboxes and submit button are all ASP controls running server-side
(as
opposed to HTML controls)

Thanks in advance!!
Andrew.

"WenJun Zhang[msft]" said:
Hi Andrew,

Welcome to ASPNET newsgroup.
From your description, one of your login page(ASP.NET2.0) which created
from a MasterPage didn't handle the login button's submit event correctly
,ye s?

Based on my understanding, when we enter "enter" key on a web page (at
lease in IE), the first submit button on the page will be clicked so as
to
submit the page. So If you found the page's login code not execute
correctly, it must be the page didn't be submit correctly. Is it working
correctly if we manually click that submit button?
also, as you mentioned that you've tried applying some tips on the
internet, would please paste some of those code snippets so that we can
have a further investigate here?

Thanks,

Steven Cheng
Microsoft Online Support

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top