错误,当前上下文中不存在名称“True”
是有关RequiredFieldValitor控件的使用的,刚自学的,想不出怎么解决,各位帮帮忙拉<%@ Page Language="C#" %>
<script language="C#" runat="server"></script>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.
<script runat="server">
protected void ValidateBtn_Click(object sender, EventArgs e)
{
if(Page.IsValid ==True)
{
Response.Write("ID:"+yourID.Text+" Email:"+yourEmail.Text );
}
}
</script>
<html xmlns="http://www. >
<head runat="server">
<title>无标题页</title>
</head>
<body>
<form id="form1" runat="server">
<div>
ID:<asp:TextBox ID="yourID" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1"
runat="server" ControlToValidate="yourID"
ErrorMessage="RequiredFieldValidator" Width="100%">请输入ID!</asp:RequiredFieldValidator><br />
Imail:<asp:TextBox ID="yourEmail" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2"
runat="server" ControlToValidate="yourEmail"
ErrorMessage="RequiredFieldValidator" Width="100%">请输入Email!</asp:RequiredFieldValidator><br />
<asp:Button ID="Button1" runat="server" OnClick="ValidateBtn_Click" Text="提交" /></div>
</form>
</body>
</html>