?
Solved

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

Posted on 2012-03-29
2
Medium Priority
?
1,878 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 13

Accepted Solution

by:
Rahul Agarwal earned 1500 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

Featured Post

Learn Veeam advantages over legacy backup

Every day, more and more legacy backup customers switch to Veeam. Technologies designed for the client-server era cannot restore any IT service running in the hybrid cloud within seconds. Learn top Veeam advantages over legacy backup and get Veeam for the price of your renewal

Question has a verified solution.

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

Introduction A frequently asked question goes something like this:  "I am running a long process in the background and I want to alert my client when the process finishes.  How can I send a message to the browser?"  Unfortunately, the short answer…
This article discusses how to implement server side field validation and display customized error messages to the client.
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

718 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