943,948 Members | Top Members by Rank

Ad:
  • ASP.NET Discussion Thread
  • Marked Solved
  • Views: 1809
  • ASP.NET RSS
Apr 3rd, 2009
0

Problem With Image Button

Expand Post »
This may be a simple solution but I cant seem to find it anywhere!

Basically I have just added an imagebutton to My masterpage I have just realised that on my login page i type in the credentials and hit enter however this triggers the image button click event and goes to the homepage.

If there is anyway to disable this I would very much appreciate it

If you require more info please let me no

Thank you in advance

Daniel
Last edited by DanielPartridge; Apr 3rd, 2009 at 5:53 am.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
DanielPartridge is offline Offline
2 posts
since Apr 2009
Apr 3rd, 2009
0

Re: Problem With Image Button

hi,

you can place the image ina updata panel and set default button to the image button.
Reputation Points: 25
Solved Threads: 29
Posting Whiz
greeny_1984 is offline Offline
372 posts
since Apr 2007
Apr 3rd, 2009
0

Re: Problem With Image Button

greeny_1984: Well that would just exhibit the same behaviour as whats currently happening. But you're on the right track.

Image buttons are rendered as type="submit" which means when you press the enter key it is assumed you are submitting. This is an HTMl Forms standard thing.

You need to place your credentials controls in an asp:Panel and set the DefaultButton attribute of the panel to the save button ID for your form.
Last edited by hollystyles; Apr 3rd, 2009 at 9:34 am.
Reputation Points: 262
Solved Threads: 68
Veteran Poster
hollystyles is offline Offline
1,181 posts
since Feb 2005
Apr 3rd, 2009
0

Re: Problem With Image Button

greeny_1984: Well that would just exhibit the same behaviour as whats currently happening. But you're on the right track.

Image buttons are rendered as type="submit" which means when you press the enter key it is assumed you are submitting. This is an HTMl Forms standard thing.

You need to place your credentials controls in an asp: Panel and set the DefaultButton attribute of the panel to the save button ID for your form.
That is brilliant such a simple solution thank you very much!
Reputation Points: 10
Solved Threads: 0
Newbie Poster
DanielPartridge is offline Offline
2 posts
since Apr 2009
Apr 3rd, 2009
0

Re: Problem With Image Button

good
Reputation Points: 16
Solved Threads: 48
Posting Whiz
BzzBee is offline Offline
327 posts
since Apr 2009

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in ASP.NET Forum Timeline: Textbox not updating...
Next Thread in ASP.NET Forum Timeline: Sql Insert problem





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC