Solved

ASP.net AJAX Modal Popup Login Box Default Button and Focus

Posted on 2012-03-29
2
1,620 Views
Last Modified: 2012-05-23
Hi All,

I have an asp:LoginStatus control that is the target conrol ID for a modal popup extender.  The modal popup has an asp:login control inside the panel with two text boxes and two buttons.

1. txtUsername
2. txtPassword
3. LoginButton
4. CancelButton

I am having trouble setting the default button and the initial focus when the modal is shown.  

All I need to accomplish is the following:

After the modal.show function is called...
1.  Set focus to the username textbox.
2.  Call the server side click event for the login button when the Enter button is pressed.

I have tried setting the default button of the panel, but that gave me an error stating that I needed to use a control of type iButton.

I tried setting the OkControlID using the clientID of the username, that seemed to do nothing.  

Currently, when you press the enter button when the popup is shown, the popup disappears.

Please Help....I don't know why this is so dificult for me....
0
Comment
Question by:dtechfish
2 Comments
 
LVL 13

Accepted Solution

by:
agarwalrahul earned 500 total points
ID: 37785755
for Setting Default button:

<script type="text/javascript">

        function pageLoad() {
            $find("MPE").add_shown(function() { $get('btnClose').focus(); });
        }
    </script>

Reference:

http://forums.asp.net/t/1381468.aspx/1



for setting focus on text box in Modal Popup:

ScriptManager.RegisterStartupScript(    this,
                                                this.GetType(),
                                                "FocusScript",
                                                "setTimeout(function(){$get('" + btnErrorClose.ClientID + "').focus();}, 100);",
                                                true);

Reference:

http://forums.asp.net/p/1111803/4078130.aspx#4078130
0
 
LVL 12

Expert Comment

by:jagssidurala
ID: 37786881
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

The Confluence of Individual Knowledge and the Collective Intelligence At this writing (summer 2013) the term API (http://dictionary.reference.com/browse/API?s=t) has made its way into the popular lexicon of the English language.  A few years ago, …
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now