467,076 Members | 1,027 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,076 developers. It's quick & easy.

Login control can't fire the button event by hitting enter

Hi, all

The scenario is like this:

I have a master page, contains two user controls, one is a search
control, another is a login control.

The server-side <form> is in the master page, that's of course.

It seems the search control is rendered first, when I stay in the
search textbox, input something, and click enter, it will fire the
search button event. That's correct.

When I stay in the login textbox, input the user name and password, and
click enter, it will always fire the search button event!

I can only use mouse to click to button to fire the login event.

How can I solve that?
Thanks
----------------------------------------
Sowen
..NET Image Components
http://www.ImageComponent.net

Apr 19 '06 #1
  • viewed: 2523
Share:
4 Replies
BTW, the search user control contains just a textbox and an ImageButton
the login user control is using the ASP:LoginView web control

Apr 19 '06 #2
In a form the enter key submits the form (thus across the whole form there
is only a single submit action). In your case the submit is firing your
search event. You may have to do some custom scripting on the client side.
Maybe add a onkeypress function to your login text box to capture the enter
key. When you do that you can change how you submit your form so you can
determine in the code that it was triggered by the login text box.

<so*********@gmail.com> wrote in message
news:11*********************@z34g2000cwc.googlegro ups.com...
Hi, all

The scenario is like this:

I have a master page, contains two user controls, one is a search
control, another is a login control.

The server-side <form> is in the master page, that's of course.

It seems the search control is rendered first, when I stay in the
search textbox, input something, and click enter, it will fire the
search button event. That's correct.

When I stay in the login textbox, input the user name and password, and
click enter, it will always fire the search button event!

I can only use mouse to click to button to fire the login event.

How can I solve that?
Thanks
----------------------------------------
Sowen
.NET Image Components
http://www.ImageComponent.net

Apr 19 '06 #3
ha, that's what I want to do too.

then I can't use <asp:loginview> control directly, I will have to
create my own login control.

frankly, it makes me a little frustrating, since apparently this is a
bug of this control or a bug about MasterPage, it seems to me that
microsoft never considered a situation like that. :(

Apr 19 '06 #4
CMM
Not sure about this... but won't wrapping the login view in a Panel and
setting default buttons... and possibly a combination of using the server
side Control.Focus alleviate this?
See here for more info...
http://weblogs.asp.net/scottgu/archi...04/421647.aspx

P.S. I hope the info above helps... but, I wouldn't be surprised if this was
indeed a bug. There's all sorts of weird "gotchas" with Master Pages (come
on... just allow us to *design* a UserControl that can act as Panel guys!
that would make Master Pages obsolete.... sheesh it's obvious... who's the
visionary at Microsoft?).

--
-C. Moya
www.cmoya.com
<so*********@gmail.com> wrote in message
news:11**********************@e56g2000cwe.googlegr oups.com...
ha, that's what I want to do too.

then I can't use <asp:loginview> control directly, I will have to
create my own login control.

frankly, it makes me a little frustrating, since apparently this is a
bug of this control or a bug about MasterPage, it seems to me that
microsoft never considered a situation like that. :(

Apr 20 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by John Lau | last post: by
7 posts views Thread by djc | last post: by
7 posts views Thread by Grant Merwitz | last post: by
1 post views Thread by Tyler Carver | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.