Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Image button acting like submit button.

Reply
Thread Tools

Image button acting like submit button.

 
 
Russell
Guest
Posts: n/a
 
      06-23-2004
I have a web page that i am using an image button as my submit button. The
code behind the button works, but when I click enter on the web page,
nothing happens. Can anybody tell me how to get my image button to act as
the default button on the form?

Thanks in advance
Russell


 
Reply With Quote
 
 
 
 
Steve C. Orr [MVP, MCSD]
Guest
Posts: n/a
 
      06-23-2004
You can intercept the client side enter keypress event of the text box and
then do what you want using javascript code.
Here's a good example:
http://www.kamp-hansen.dk/pages/show...d=21&menuid=18

You could also try using this free control.
http://www.metabuilders.com/tools/DefaultButtons.aspx

And here's a couple good articles on the subject:
http://www.allasp.net/enterkey.aspx
http://www.aspnetpro.com/features/20...200406so_f.asp

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net


"Russell" <> wrote in message
news:...
> I have a web page that i am using an image button as my submit button. The
> code behind the button works, but when I click enter on the web page,
> nothing happens. Can anybody tell me how to get my image button to act as
> the default button on the form?
>
> Thanks in advance
> Russell
>
>



 
Reply With Quote
 
 
 
 
Eric Cherng
Guest
Posts: n/a
 
      06-23-2004
Russell,

I've had this problem before too and, to my knowledge at least, there is no
direct way to achieve this. Instead what I did was provide a handler for
the text box that handles the enter key. If the handler gets called, it
just forwards the processing to the image button's submit handler. This
solution isn't exactly the most elegant way, but it works.

Eric


"Russell" <> wrote in message
news:...
> I have a web page that i am using an image button as my submit button. The
> code behind the button works, but when I click enter on the web page,
> nothing happens. Can anybody tell me how to get my image button to act as
> the default button on the form?
>
> Thanks in advance
> Russell
>
>



 
Reply With Quote
 
Lau Lei Cheong
Guest
Posts: n/a
 
      06-24-2004
It's very strange that in my project, they automatically act as a submit
button, so I have to add a (X,Y) = (0,0) checker in the click handler
routine just to skip when "enter" is pressed in the textbox.

Perheps there are more than one ImageButton in your form so the browser got
it mixed up.

"Eric Cherng" <ericch1@remove_the_dot-hotmai.l.com> ¦b¶l¥ó
news:% ¤¤¼¶¼g...
> Russell,
>
> I've had this problem before too and, to my knowledge at least, there is

no
> direct way to achieve this. Instead what I did was provide a handler for
> the text box that handles the enter key. If the handler gets called, it
> just forwards the processing to the image button's submit handler. This
> solution isn't exactly the most elegant way, but it works.
>
> Eric
>
>
> "Russell" <> wrote in message
> news:...
> > I have a web page that i am using an image button as my submit button.

The
> > code behind the button works, but when I click enter on the web page,
> > nothing happens. Can anybody tell me how to get my image button to act

as
> > the default button on the form?
> >
> > Thanks in advance
> > Russell
> >
> >

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
use an anchor to submit, or set image for submit button mikezx10@hotmail.com ASP General 4 03-23-2010 01:25 AM
Acting like button are being pressed (BUT THEY ARE NOT) Please Help mcsejung Python 2 02-22-2008 03:19 PM
Changing a HTML submit button that requests a Servlet, to an image button? How? James Storey via JavaKB.com Java 7 04-08-2005 06:10 PM
Preventing Multiple submit (Disabling Submit Button Post Click) Solution Mark ASP .Net 1 12-13-2004 08:03 PM
Disable Submit Button on Post back and On Submit in ASP.net Ghafran Abbas ASP .Net 0 10-12-2004 06:11 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57