473,326 Members | 2,182 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,326 software developers and data experts.

the mystery of a default button

This is quite serious - for a beginner...
No property setting for a default button? I just want a button on a search
page to automatically be pressed when I hit the return/enter key.

Somehow I did it with one of my 2 buttons, (but I don't know how)
one of the buttons (cmdClear) decided on its own to be the default button -
instead of the cmdSearchMember button - so much so that even after searching
and finding 2 other solutions:
1) 'RegisterHiddenField("__EVENTTARGET", "cmdSearchMember")
2) Javascript -that ends up with:
SetDefaultButton(Me.txtNAME_ID, cmdSearchMember) in the load event of
the form.

.... the other button (cmdClear) continues to be selected and is
automatically pushed when I hit the enter (return) key.

Please help, I know the solution isn't to grab my code from the
cmdSearchMember button and add it to the cmdClear button - although that is
becoming quite tempting.

Dec 25 '05 #1
2 1275
If you are in 2.0, you do have property DefaultButton.

In 1.1 the first button on the form is always the default one.

Eliyahu

"jonefer" <jo*****@discussions.microsoft.com> wrote in message
news:0E**********************************@microsof t.com...
This is quite serious - for a beginner...
No property setting for a default button? I just want a button on a
search
page to automatically be pressed when I hit the return/enter key.

Somehow I did it with one of my 2 buttons, (but I don't know how)
one of the buttons (cmdClear) decided on its own to be the default
button -
instead of the cmdSearchMember button - so much so that even after
searching
and finding 2 other solutions:
1) 'RegisterHiddenField("__EVENTTARGET", "cmdSearchMember")
2) Javascript -that ends up with:
SetDefaultButton(Me.txtNAME_ID, cmdSearchMember) in the load event of
the form.

... the other button (cmdClear) continues to be selected and is
automatically pushed when I hit the enter (return) key.

Please help, I know the solution isn't to grab my code from the
cmdSearchMember button and add it to the cmdClear button - although that
is
becoming quite tempting.

Dec 25 '05 #2
Hi Jonefer,

You do not have to switch the code in your buttons. In ASP.NET 1.1, you may
still create a webpage with more than one section in it; each section can
have the equivalent of a "default" by adding a few lines of JavaScript to
attach the event OnKeyPress of each textbox to trigger a different button's
Click event. For a demo take a look at this sample:
http://www.societopia.net/samples/ASPPage_Buttons.aspx
--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"jonefer" wrote:
This is quite serious - for a beginner...
No property setting for a default button? I just want a button on a search
page to automatically be pressed when I hit the return/enter key.

Somehow I did it with one of my 2 buttons, (but I don't know how)
one of the buttons (cmdClear) decided on its own to be the default button -
instead of the cmdSearchMember button - so much so that even after searching
and finding 2 other solutions:
1) 'RegisterHiddenField("__EVENTTARGET", "cmdSearchMember")
2) Javascript -that ends up with:
SetDefaultButton(Me.txtNAME_ID, cmdSearchMember) in the load event of
the form.

... the other button (cmdClear) continues to be selected and is
automatically pushed when I hit the enter (return) key.

Please help, I know the solution isn't to grab my code from the
cmdSearchMember button and add it to the cmdClear button - although that is
becoming quite tempting.

Dec 25 '05 #3

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

Similar topics

9
by: Lovely Dola | last post by:
I have set the MaxLength property of a textbox in a form to 5 at design time. When I change the MaxLength back to 0 during run-time under some condition (for example, after clicking a command...
0
by: Francis Avila | last post by:
A few days ago (see the 'itertools.flatten()?' thread from October 28) I became obsessed with refactoring a recursive generator that yielded the leaves of nested iterables. When the dust settled,...
3
by: Nicolae Fieraru | last post by:
Hi All, I have a lot of problems with the web site www.ggsurf.com.au I host on www.gnxonline.com and I want to find out if it is my own problem or theirs. I try to use session cookies and it...
8
by: Al Reynolds | last post by:
Afternoon, In an earlier thread (http://tinyurl.com/5v4aa), I described a problem I was having which was rather bizarrely solved by changing the line: "inputbox.value = numq+ag-cw-cc;" to:...
0
by: William Wisnieski | last post by:
Hello Everyone: I'm having a very strange problem occurring with my Access 2000 database. I call it the "mystery record." Here's the story: I have a query by form that returns a record set...
4
by: Amelyan | last post by:
How do I force my Page to Page_Load when user clicks browser's Back button? I am trying to avoid this error, that I get when I hit back button on my browser and click on my dynamically generated...
18
by: surfrat_ | last post by:
Hi, I am having the following problems in getting Microsoft Visual Studio 2005 Professional to link to an Access .mdb database. Please help me to sort this out. Problem 1: The Microsoft...
3
by: GaryDean | last post by:
I have a situation where characters are somehow getting stripped from a textbox in an ItemTemplate in a cell of a DataGrid. In the itemDataBound event I am moving data from columns created at run...
0
by: TechWitch | last post by:
I've seen a number of posts from frustrated folks about this topic, with not much offered as a solution. I actually managed to get this to work today, so I thought I'd post for the benefit of the...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.