Loading gif on login control
<p>I would like my login control to have a "Loading..." gif shown when a user logs in.</p>

<p>In order to have my login control display how I wanted, I converted it to a template.  I then followed the guidance seen here: <a href="http://stackoverflow.com/questions/7235722/display-a-gif-while-asp-net-page-loads">here</a> and <a href="http://www.ezzylearning.com/tutorial.aspx?tid=8964873" rel="nofollow">here</a> to show the gif during a postback.</p>

<p>I'm having a couple of problems now though.  When I try to sumbit an invalid login, the page does as it's supposed to: it shows the loading gif, and then the gif goes away after the login is determined invalid.  But now even when I enter a valid login it says it's invalid.  Did I mess something up when I edited the login template?</p>

<p>My other problem is that I have the "keepLogged" checkbox stylized.  The style is being added by JQuery in the head.  It shows it properly when you first go to the page, but after the postback, when the login is shown to be invalid, the style isn't applied and it's a normal checkbox.</p>

<p>Here's the code:</p>

<pre><code>&lt;script&gt;

    $(document).ready(function () {

        $("input[type=checkbox]").addClass("mini-switch");

    });

&lt;/script&gt;

&lt;form id="form1" runat="server" class="form with-margin" name="login-form"&gt;
            &lt;div&gt;
                &lt;asp:ScriptManager ID="ScriptManager1" runat="server"&gt;&lt;/asp:ScriptManager&gt;

                &lt;asp:UpdatePanel ID="updateLogin" runat="server" DefaultButton="mainLogin$LoginButton"&gt;
                &lt;ContentTemplate&gt;
                &lt;asp:Login ID="mainLogin" runat="server" RenderOuterTable="False" onloginerror="mainLogin_LoginError"&gt;
                    &lt;LayoutTemplate&gt;
                        &lt;div class="block-header"&gt;Please login&lt;/div&gt;
                        &lt;asp:ValidationSummary ID="LoginUserValidationSummary" runat="server"  
                        ValidationGroup="mainLogin"  CssClass="message error no-margin"
                        DisplayMode="List"/&gt;


                        &lt;input type="hidden" name="a" id="a" value="send"&gt;
                        &lt;p class="inline-small-label"&gt;
                            &lt;asp:Label ID="UserNameLabel" runat="server" AssociatedControlID="UserName"&gt;&lt;span class="big"&gt;User name&lt;/span&gt;&lt;/asp:Label&gt;

                            &lt;asp:TextBox ID="UserName" runat="server" CssClass='full-width'&gt;&lt;/asp:TextBox&gt;

                            &lt;asp:RequiredFieldValidator ID="UserNameRequired" runat="server" 
                                ControlToValidate="UserName" ErrorMessage="User Name is required." 
                                ToolTip="User Name is required." ValidationGroup="mainLogin" 
                                Display="None" /&gt;
                        &lt;/p&gt;
                        &lt;p class="inline-small-label"&gt;
                            &lt;asp:Label ID="PasswordLabel" runat="server" AssociatedControlID="Password"&gt;&lt;span class="big"&gt;Password&lt;/span&gt;&lt;/asp:Label&gt;

                            &lt;asp:TextBox ID="Password" runat="server" TextMode="Password" CssClass='full-width'&gt;&lt;/asp:TextBox&gt;

                            &lt;asp:RequiredFieldValidator ID="PasswordRequired" runat="server" 
                                ControlToValidate="Password" ErrorMessage="Password is required." 
                                ToolTip="Password is required." ValidationGroup="mainLogin" 
                                Display="None" /&gt;                
                        &lt;/p&gt;


                        &lt;asp:Button ID="LoginButton" runat="server"  CommandName="Login" 
                        Text="Log In" type="button"
                        ValidationGroup="mainLogin" onclick="LoginButton_Click" CSSClass='button float-right'/&gt;


                        &lt;p class="input-height"&gt;
                            &lt;asp:CheckBox ID="keepLogged" runat="server" Checked="True"/&gt; 

                            &lt;asp:Label ID="Label1" runat="server" Text="Keep me logged in" AssociatedControlID="keepLogged" CssClass="inline"&gt;&lt;/asp:Label&gt;
                        &lt;/p&gt;

                    &lt;/LayoutTemplate&gt;

                &lt;/asp:Login&gt;
                &lt;/ContentTemplate&gt;
                &lt;/asp:UpdatePanel&gt;



          &lt;/div&gt;
            &lt;asp:UpdateProgress ID="UpdateProgress1" runat="server"&gt;
                    &lt;ProgressTemplate&gt;
                      &lt;img alt="" src="images/lock.gif" /&gt; &lt;strong&gt;Logging In...&lt;/strong&gt;
                   &lt;/ProgressTemplate&gt;
            &lt;/asp:UpdateProgress&gt; 
&lt;/form&gt;
</code></pre>

<p>Thanks for any help.</p>
