In my login page, i use radtextbox as passord input box and radtoolbar button as [Login] button.
it works fine if user input password and then click [Login] button by mouse.
but it had problem that if user input password and then press [ENTER]. it cannot capture the event and then login.
the password will disappear and remain login page after press [ENTER].
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="IntranetPassword.aspx.vb" Inherits="Remuneration_IntranetPassword" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<
html
xmlns
=
"http://www.w3.org/1999/xhtml"
>
<
head
id
=
"Head1"
runat
=
"server"
>
</
head
>
<
body
>
<
form
id
=
"form1"
runat
=
"server"
>
<
telerik:RadScriptManager
ID
=
"RadScriptManager1"
runat
=
"server"
>
</
telerik:RadScriptManager
>
<
TABLE
BORDER
=
0
bgcolor
=
"#FFFFFF"
width
=
"386"
height
=
"300"
>
<
tr
>
<
TD
width
=
"400"
height
=
"42"
>
<
p
align
=
"justify"
>
<
p
align
=
"justify"
>
<
asp:Label
ID
=
"lbDescription"
runat
=
"server"
Text
=
"This page is STRICTLY CONFIDENTIAL. Please input your intranet password again to validate your credential."
></
asp:Label
>
</
TD
>
</
TR
>
<
TR
bgcolor
=
"#99CCFF"
>
<
TD
height
=
"1"
width
=
"400"
> <
FONT
style
=
"font-weight: bold; font-size: medium; color: #800000"
></
FONT
>Please Enter Your Intranet Password </
TD
>
</
TR
>
<
TR
>
<
TD
width
=
"449"
height
=
"228"
nowrap>
<
div
id
=
"Layer1"
style
=
"position:absolute; width:184; height:191; z-index:1; left: 51; top: 204; background-image: url('../Images/login.gif'); border: 1px none #000000; background-repeat: no-repeat;"
>
<
table
height
=
"48"
>
<
tr
>
<
td
height
=
"42"
width
=
"167"
nowrap
colspan
=
"2"
> </
td
>
</
tr
>
<
tr
>
<
td
width
=
"167"
height
=
"1"
nowrap
colspan
=
"2"
>
</
td
>
</
tr
>
<
tr
>
<
td
width
=
"167"
height
=
"9"
colspan
=
"2"
nowrap>
<
div
align
=
"left"
><
b
><
br
/><
font
size
=
"2"
> Intranet Password</
font
></
b
><
font
size
=
"2"
>
</
font
>
</
div
>
</
td
>
</
tr
>
<
tr
>
<
td
width
=
"167"
nowrap
height
=
"1"
colspan
=
"2"
>
<
p
align
=
"right"
>
<
telerik:RadTextBox
ID
=
"dfPassword"
runat
=
"server"
Width
=
"150px"
TextMode
=
"Password"
>
</
telerik:RadTextBox
>
<
asp:RequiredFieldValidator
ID
=
"RequiredFieldValidator1"
runat
=
"server"
ErrorMessage
=
"* Required"
ControlToValidate
=
"dfPassword"
></
asp:RequiredFieldValidator
>
</
td
>
</
tr
>
<
tr
>
<
td
width
=
"62"
height
=
"31"
></
td
>
<
td
width
=
"109"
height
=
"31"
nowrap>
<
telerik:RadToolBar
ID
=
"RadToolBar1"
runat
=
"server"
Width
=
"56px"
AutoPostBack
=
"true"
OnButtonClick
=
"RadToolBar1_ButtonClick"
>
<
Items
>
<
telerik:RadToolBarButton
Value
=
"Save"
Text
=
"LOGIN"
Width
=
"40px"
CommandName
=
"DefaultButton"
>
</
telerik:RadToolBarButton
>
</
Items
>
</
telerik:RadToolBar
>
<
asp:PlaceHolder
runat
=
"server"
ID
=
"ph_javascript"
>
<
script
type
=
"text/javascript"
>
function onEnter(e) {
if (e.keyCode == 13) {
window["<%=RadToolBar1.ClientID%>"].GetButtonByCommand("DefaultButton").EventClick(e);
}
}
if (document.attachEvent) {
document.attachEvent("onkeyup", onEnter);
}
else if (document.addEventListener) {
document.addEventListener("keyup", onEnter, false);
}
</
script
>
</
asp:PlaceHolder
>
</
td
></
tr
>
</
table
>
</
div
>
</
TD
>
</
TR
>
<
tr
>
<
td
>
</
td
>
</
tr
>
</
TABLE
>
</
form
>
</
body
>
</
html
>
Code Behind:
Imports Telerik.Web.UI
Partial Class Remuneration_IntranetPassword
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
End Sub
Protected Sub RadToolBar1_ButtonClick(ByVal sender As Object, ByVal e As Telerik.Web.UI.RadToolBarEventArgs) Handles RadToolBar1.ButtonClick
If e.Item.Value = "Save" Then
Dim dc As New dcHRISDataContext
Dim rec = (From d In dc.UserDBs Where d.SID = GetProfile() Select d).FirstOrDefault
If Not IsNothing(rec) Then
If rec.Password = dfPassword.Text Then
xxxxxxx
End If
End If
lbDescription.Text = "The intranet password is incorrect."
lbDescription.ForeColor = Drawing.Color.Red
End If
End Sub
End Class