Solved

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

Posted on 2012-03-29
2
1,686 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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Got endorsements from your clients?  Great!  There is almost nothing better than word-of-mouth advertising.  But how can you do that on the internet?  Sure you can make a page for endorsement quotations and list them all, but who is …
I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

770 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