簡體   English   中英

在ASP登錄上輸入密鑰

[英]Enter key on ASP Login

在aspx頁面上,我在表單內有一個asp:login控件。 當我按下登錄按鈕時,一切正常,但是當我按下Enter鍵時,頁面被重新加載,但沒有其他反應。 無法訪問loginbutton處理函數。

在aspx上:

<form id="form1" class="login-form" runat="server" DefaultButton="lgLogin$LoginButton">    
    <asp:Login ID="lgLogin" runat="server" Width="100%"
        FailureText="Some text here"
        PasswordRequiredErrorMessage="Some text here"          
        UserNameRequiredErrorMessage="Some text here"
        TextLayout="TextOnLeft" 
        OnAuthenticate="lgLogin_Authenticate" 
        DestinationPageUrl="~/Welcome.aspx"
        OnLoginError="lgLogin_Error"
        DisplayRememberMe="False" >
        <LayoutTemplate>
            <div class="form-group">
                <label class="control-label visible-ie8 visible-ie9">Login</label>
                <div class="input-icon">
                    <i class="fa fa-user"></i>                
                    <asp:TextBox runat="server" type="text" ID="UserName" CssClass="form-control placeholder-no-fix" placeholder="Login" />
                </div>
            </div>
            <div class="form-group">
                <label class="control-label visible-ie8 visible-ie9">Password</label>
                <div class="input-icon">
                    <i class="fa fa-lock"></i>
                    <asp:TextBox runat="server" type="password" ID="Password" CssClass="form-control placeholder-no-fix" placeholder="Password" />
                </div>
            </div>

            <div id="AlertError" runat="server" class="alert alert-danger" visible="false">
                <button class="close" data-close="alert"></button>
                <span>
                    <asp:Label ID="FailureText" runat="server" ></asp:Label>
                </span>
            </div>

            <div class="form-actions">
                <asp:Button type="submit" class="btn blue pull-right" ID="LoginButton" runat="server" CommandName="Login" Text='Login now' />
            </div>
        </LayoutTemplate>           
        <TextBoxStyle CssClass="form-control placeholder-no-fix"/>
        <LoginButtonStyle CssClass="btn blue pull-right" />
    </asp:Login>
</form>

僅當按下LoginButton時,才能訪問lgLogin_authenticate void。

編輯

解決了 實際上,它運行良好。 問題出在此頁面中。 它捕獲了Enter鍵以進行一些檢查,但是最后它沒有調用提交按鈕。

 protected void Page_Load(object sender, EventArgs e)
 {
       button1.Focus();
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM