473,394 Members | 1,752 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

NOT have a default button?

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?
--
Gregory Gadow
te******@serv.net
Nov 15 '06 #1
2 1690
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.

Gregory Gadow wrote:
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?
--
Gregory Gadow
te******@serv.net
Help defend marriage in Washington state!
http://www.wa-doma.org
Nov 15 '06 #2
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
Nov 15 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Billy Jacobs | last post by:
Is there a way to make a button on a web form the default button so that when the user hits the enter button the code for that button executes? I have a web page Login.aspx where I have only 1...
0
by: Shixx | last post by:
Hello, I have problem in my web application and my web form. I have 5-6 buttons (web controls) and when I have focus on some text box, always one button becomes default and got focus, and after I...
3
by: Marty McFly | last post by:
Hello, I have a control class that inherits from System.Web.UI.WebControls.Button. When I drag this control from the "My User Controls" tab in the toolbox onto the form, I want it to reflect the...
5
by: Wonder | last post by:
How can I create or use the msgobx to show a message without a default button. The user has explicity to click on the button, so the msgbox closes it. Thanks,
10
by: cj | last post by:
Here's an easy one, I hope. How do I make button1, which I put on this form from the toolbox, the default button on the form? I thought it used to be a property in the properties window called...
3
by: Rick Brandt | last post by:
I am using some buttons to hide/show various divs and am changing the style of the button to indicate which button's view is "active". My problem is that for the non-active buttons I want the...
3
by: Anil Kumar Sharma | last post by:
Hello, I am working on C# using vs.net 2003. I have faced two interesting problems. 1. Dynamically setting Default Button: I created a form and used it in various contexts. On basis of the...
15
by: simonoficina | last post by:
Hello all! I am a vb.net beginner in Spain. When I use VB6 ,the button object has a property called "default" that can set this button like press "ENTER" key. But in the VB.net I can't find this...
1
by: JJ | last post by:
What trouble I'm having setting default buttons on a page (with a master page). I got around doing it on a page basis by calling the SetWizardDefaultButton() routine from page load. Notice how...
4
by: Whasigga | last post by:
Hi I've created a form that has 7 subforms. It is the same subform, bound to a table, just repeated. This form represents a week, and each subform is used to enter in data for each day of the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.