Solved

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

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Introduction HyperText Transfer Protocol (http://www.ietf.org/rfc/rfc2616.txt) or "HTTP" is the underpinning of internet communication.  As a teacher of web development I have heard many questions, mostly from my younger students who have come to t…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

752 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