<%@ Page Language=
"C#"
AutoEventWireup=
"true"
CodeFile=
"AddStudent.aspx.cs"
Inherits=
"AddStudent"
%>
<!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 runat=
"server"
>
<title></title>
<style type=
"text/css"
>
.clsShow
{
font-size: 13px;
border: solid 1px
#cc3300;
padding: 2px;
display: none;
margin-bottom: 5px;
background-color:
#ffe0a3;
}
</style>
<script type=
"text/javascript"
src=
"Scripts/jquery-1.4.2.js"
></script>
<script type=
"text/javascript"
>
$(
function
() {
$(
"#btnSave"
).click(
function
() {
if
($(
".clsShow"
).html().toString() !=
""
)
return
false
;
else
return
true
;
});
$(
"#txtNum"
).focus();
$(
"#txtNum"
).keydown(
function
(event) {
if
(event.which ==
"13"
) {
$(
"#txtName"
).focus();
$(
"#txtNum"
).trigger(
"blur"
);
}
});
$(
"#txtNum"
).blur(
function
() {
var
strTxtName = encodeURI($(
"#txtNum"
).val());
$.ajax
({
url:
"Check.ashx"
,
type:
"post"
,
data: { txtNum: strTxtName },
success:
function
(strValue) {
if
(strValue ==
"True"
) {
$(
".clsShow"
).css(
"display"
,
"inline"
);
$(
".clsShow"
).html(
"学号已存在,请修改!"
);
}
else
{
$(
".clsShow"
).hide();
$(
".clsShow"
).html(
""
);
}
}
})
})
})
</script>
</head>
<body>
<form id=
"form1"
runat=
"server"
>
<div>
学号:<asp:TextBox
ID=
"txtNum"
runat=
"server"
></asp:TextBox>
<asp:RequiredFieldValidator ID=
"RequiredFieldValidator1"
runat=
"server"
ControlToValidate=
"txtNum"
ErrorMessage=
"不能为空"
></asp:RequiredFieldValidator>
<div class=
"clsShow"
></div>
<br />
姓名:<asp:TextBox ID=
"txtName"
runat=
"server"
></asp:TextBox>
<asp:RequiredFieldValidator ID=
"RequiredFieldValidator2"
runat=
"server"
ControlToValidate=
"txtName"
ErrorMessage=
"不能为空"
></asp:RequiredFieldValidator>
<br />
数学:<asp:TextBox
ID=
"txtMath"
runat=
"server"
></asp:TextBox>
<asp:RequiredFieldValidator ID=
"RequiredFieldValidator3"
runat=
"server"
ControlToValidate=
"txtMath"
ErrorMessage=
"不能为空"
></asp:RequiredFieldValidator>
<asp:RangeValidator ID=
"RangeValidator1"
runat=
"server"
ControlToValidate=
"txtMath"
ErrorMessage=
"分数在0-100之间"
MaximumValue=
"100"
MinimumValue=
"0"
Type=
"Integer"
></asp:RangeValidator>
<br />
英语:<asp:TextBox ID=
"txtEnglish"
runat=
"server"
></asp:TextBox>
<asp:RequiredFieldValidator ID=
"RequiredFieldValidator4"
runat=
"server"
ControlToValidate=
"txtEnglish"
ErrorMessage=
"不能为空"
></asp:RequiredFieldValidator>
<asp:RangeValidator ID=
"RangeValidator2"
runat=
"server"
ControlToValidate=
"txtEnglish"
ErrorMessage=
"分数在0-100之间"
MaximumValue=
"100"
MinimumValue=
"0"
Type=
"Integer"
></asp:RangeValidator>
<br />
语文:<asp:TextBox ID=
"txtChinese"
runat=
"server"
></asp:TextBox>
<asp:RequiredFieldValidator ID=
"RequiredFieldValidator5"
runat=
"server"
ControlToValidate=
"txtChinese"
ErrorMessage=
"不能为空"
></asp:RequiredFieldValidator>
<asp:RangeValidator ID=
"RangeValidator3"
runat=
"server"
ControlToValidate=
"txtChinese"
ErrorMessage=
"分数在0-100之间"
MaximumValue=
"100"
MinimumValue=
"0"
Type=
"Integer"
></asp:RangeValidator>
<br />
<asp:Button ID=
"btnSave"
runat=
"server"
Text=
"保存"
onclick=
"btnSave_Click"
/>
<asp:Button ID=
"btnBack"
runat=
"server"
Text=
"返回"
CausesValidation=
"False"
onclick=
"btnBack_Click"
/>
<asp:Label ID=
"lblMsg"
runat=
"server"
></asp:Label>
</div>
</form>
</body>
</html>