473,243 Members | 1,626 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,243 software developers and data experts.

GRRR! Pages submitting with Enter key, combined with .ASCX pages - help!

Totally hacked off here. I've written a user control that contains a
text box, a required field validator and a button (these being the
cornerstone of a search facility), all as ASP.Net server controls. The
user clicks the button, and server-side code does a redirect to a
search page, appending the search expression to the URL.

Great, I thought, let's move on. I then wrote an mailing list page
which included the aforementioned user control, then another textbox,
required field validator and button.

So, I load up the page, click the "Submit Email Addy" button - and the
search button required field validator kicks in. After research (on
Google Groups, natch), I figure out that it forms part of the page.
So, I disable the required field validator and it's viewstateenabled
properties. Then, when the user clicks the button, I re-enable the req
field validator, call Page.Validate(), and continue if things are ok.

This, when applied to my buttons and text boxes appeared to work - but
only if the buttons are clicked!!! If someone hits enter whilst in the
text box, the page submits, which is not desired. I've written a page
that, er, pages data with next/prev buttons. These buttons have their
viewstate disabled so I can enable them each time the page loads. So,
when the user hits enter in the text box, the whole page submits (the
validator code doesn't get fired) and the prev\next buttons are
disabled because that's their initial setting.

After yet more research, I found some javascript code that disables
the enter key in a text box, which works great... EXCEPT NOW, IF YOU
HIT ENTER JUST WITH FOCUS ON THE BROWSER, IT STILL SUBMITS!!! And the
search required field validator kicks in, which it most definitely
shouldn't (unless it's being picked up as the first "submit" button in
the page, yeah, that'd be it).

So, as just alluded to, I did more research and found out about
ASP.Net rendering ASP:button down to an <input type="submit"> control
and that reacts to a Enter keystroke because it's on a form.

In a nutshell: how do I a) stop the page from submitting JUST BY THE
USER HITTING ENTER and b) have separate textboxes, req. field
validators and buttons that act independently of each other?

Oh yeah: All by server-side stuff, no Javascript...

Thanks,

Mike Kingscott
Nov 18 '05 #1
0 1214

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

Similar topics

3
by: Mr. B | last post by:
GRRRR... I've run across a situation in which I have NO solution. Hopefully there is one. VB.net. It's rather simple. I've a ComboBox that get's populated via a Database. And I pre-select...
30
by: SpreadTooThin | last post by:
Damn.. FILE *fp was just sooo much easier than C++ file i/o... I just don't get it.. really! filebuf, istream, ostream, ifstream, ofstream, iosteam... what the f&(){( do I use to do binary file...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
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...

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.