ログインページがあります..ユーザー名とパスワードが含まれている場所..ユーザー名とパスワードの値を入力してTABを押してからEnterを押すと、次のページに移動します..しかし、私の要件は値を入力した後です. Tabボタンを押さずにEnterキーを押すと、次のページに移動するはずです..私はC#を使用してasp.netでこのコードを実行しています..
ユーザー名 --------------- パスワード --------------- ログイン
以下はaspxコードです
style="top: 198px; left: 561px; position: absolute; height: 22px; width: 128px"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" ErrorMessage="Please enter the username" ControlToValidate="txtuser" Display="None" ValidationGroup="Validation" SetFocusOnError="true"></asp:RequiredFieldValidator>
<asp:TextBox
ID="txtpass" runat="server"
style="top: 239px; left: 561px; position: absolute; height: 22px; width: 128px"
TextMode="Password"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="Please enter the password" ControlToValidate="txtpass" Display="None" ValidationGroup="Validation" SetFocusOnError="true"></asp:RequiredFieldValidator>
<asp:Label ID="Label1" runat="server" Text="Username"></asp:Label>
</p>
<p>
<asp:Button ID="Button1" runat="server" onclick="Button1_Click"
style="top: 289px; left: 512px; position: absolute; height: 30px; width: 76px"
Text="Login" ValidationGroup="Validation" BackColor="#993300" ForeColor="White" />
<asp:Label ID="Label2" runat="server" Text="Password"></asp:Label>
C#で
if (e.keyPress == 13)//Error..
{
if (Username == "admin")
{
Response.Redirect("~/Admin/admininfo.aspx");
}
else
{
Response.Redirect("~/Faculty/facultyinfo.aspx");
}
}
}
この問題について助けが必要です...コードはc#で書かれるべきです..私はVS 2010を使用しています..