2012-03-05 73 views
0
<script type="text/javascript"> 

     $(function() { 

      $('#LogStatusLable').click(function() { 
       $('#LoginPanel').slideToggle("slow"); 
      }); 
      $('#LoginPanel').hide(); 

     }); 
    </script> 

<div id="LoginPanel"> 
    <br /> 
    <div class="grid_6"> 
    <br /> 
    <a>New User Registration</a> 
    </div> 
    <table class="grid_6"> 
     <tr> 
     <td>Email-ID</td> 
     <td> 
     <asp:TextBox runat="server" ID="UsernameTextBox" Width="150px"></asp:TextBox> 
     </td> 
     </tr> 
     <tr> 
     <td>Password</td> 
     <td> 
     <asp:TextBox runat="server" ID="PasswordTextBox" TextMode="Password" Width="150px"></asp:TextBox> 
     </td> 
     </tr> 
     <tr> 
     <td colspan="2"><asp:Label runat="server" ID="LoginValidation" Text=""></asp:Label> </td> 
     </tr> 
     <tr> 
     <td> 
    <asp:Button ID="Login" runat="server" UseSubmitBehavior="true" Text="Login" 
             CssClass="buttoncss" onclick="Login_Click" /> 
     <br /> <br /> 
     </td> 
     </tr> 
    </table> 

</div> 

protected void Login_Click(object sender, EventArgs e) 
    { 
     if (UsernameTextBox != null && PasswordTextBox.Text != null) 
     { 
      if (_user.GetandSetUserDetails(UsernameTextBox.Text, PasswordTextBox.Text)) 
      { 

      } 
      else 
      { 
       LoginValidation.Text = "Invalid username or password"; 
      } 
     } 
     else 
     { 
      LoginValidation.Text = "Enter the Username and Password"; 
     } 
    } 

我用jquery滑動並滑動div標籤。它的工作正常,但在div標籤的內部我使用了asp:按鈕,它運行得不好。 onclick屬性是劑量工作。請幫我找到一個解決方案。Onclick不在asp:Button中工作?

謝謝。

+1

您是否在使用任何[Login-Control](http://msdn.microsoft.com/zh-cn/library/ms178329.aspx)? page_load發生了什麼? 「Login_Click」是codebehind還是aspx的一部分(也許你忘了添加'