NOT have a default button?

G

Gregory Gadow

I have a large website written to use ASP.Net 2.0. The master page has a
"logout" button. If the child page does not have an explicitly defined
default button (most do not), the page posts back with the logout button
as the default, throwing the user out of the system.

I can supress all postbacks by putting "onsubmit='return false'" in the
form tag of the master page. That, however, renders all button clicks
and other postback calls non-functional. Is there a way in ASP.Net 2.0
to supress the concept of a default button entirely but still leave
buttons functional?
 
G

Gregory Gadow

I managed to work out the solution I needed. To the javascript file already
being loaded by the master page, I added:

function NoEnterKey(e) {
var key;

if (window.event) key=window.event.keyCode;
else if (e) key=e.which;
else return true;

if (key==0x000D) return false; else return true;
}

Then in the form tag on the master page, I stuck in this:

onkeydown="return NoEnterKey(event);"

Seems to work! Thanks anyway.
 
D

darrel

Seems to work! Thanks anyway.

Is this a public web site? If so, some folks may not have javascript
enabled. Not sure if that will make a difference or not, but just a heads
up...

-Darrel
 

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

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top