Domanda

I have a login status control on master page. If the user has not logged in to the site, the login status control will show "Login" and if a user click on "Login" it usually redirect to Login.aspx or whatever we set in web.config rite? I would like to show a PopUp dialog box (probably with Jquery) when user click "Login" on login status control.

How can I raise an event when user click on "Login" on Login Status control ?

Note: this question is not about how to make a popup box in jquery.

Thanks.

L

È stato utile?

Soluzione

I was just working on figuring this out and came up with this:

               <asp:LoginView runat="server">
                    <AnonymousTemplate>
                            <a id="mainLoginLink" href="#">Login</a>
                            <div id="mainLoginPopup">
                                <asp:Login runat="server" ID="mainLoginControl">

                                </asp:Login>
                            </div>
                    </AnonymousTemplate>
                    <LoggedInTemplate>
                        <asp:LoginStatus ID="LoginStatus1" runat="server" LoginText="" />
                    </LoggedInTemplate>
                </asp:LoginView>

Basically, the LoginView shows a custom "Login" link which you could use to show a popup by binding to the click event. Using jQuery this would look like this:

$("#mainLoginLink").click(function(e) {
     $("#mainLoginPopup").show("fast");
 });

The popup would be hidden initially, of course.

When the user is logged in, the the normal "Logout" link will be shown.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top