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

S

sowencheung

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
 
S

sowencheung

BTW, the search user control contains just a textbox and an ImageButton
the login user control is using the ASP:LoginView web control
 
C

Chad

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.
 
S

sowencheung

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. :(
 
C

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/archive/2005/08/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?).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top