Click here to Skip to main content
15,882,388 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Guys,

i know that this is in general a common taks. But i am bothered by an issue i cannot handle without any further assistance and i cannot find a solution on google.

i just create an aspx page. this page contains several elements like header/footer (master-site ref), 3 textboxes (username,email,password) and finally to start a login sequence a button that performs a callback-method. The method checks if the textboxes are filled correctly and if the user exists. After that the user gets forwarded to a user-role depending page. if the user fills in incorrect string or if he does not exist in the db an error specific string is transferred to a label. by Debuging several cases i found the following problem.

if i put correct strings into the textboxes and submit via mouse-click or by pressing the enter/return-button everything looks fine. But when i simulate incorrect information and press the enter key to submit, the page makes a callback and finally redirects to another page. The URL of this page is neither hardcoded anywhere inside the html nor takes place inside the code-behind Is anybody out there who had a similar problem in the past or does someone have a good idea?
I checked out the javascript-events and afaik every depending element properties.
Is it possible that somehow by pressing the enter key a hidden postback is triggered?
Is there a way to make sure that pressing the enter key only triggers a single event/postback. my brain hurts and this issue took nearly more time than coding the page...

Kind regards
Updated 22-Jul-15 7:28am
Sergey Alexandrovich Kryukov 22-Jul-15 14:21pm    
I don't understand the problem. Don't add event handlers you don't want, so the click will trigger only what you want. Is it a regular button or the one of Submit type? For 100% pure post, make a brand-new button, not in a form, add one and only one event handler and make some Ajax call in it...
Dennis Eckermann 22-Jul-15 18:18pm    
thanks i will try the untouched button. the mean problem is that if the user has focus on one of the three buttons he should be able to press the enter key to perform the callback and without the onClick event it didnt work. i will see if a new button works. thanks in advance

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900