<html>
<body>

<form runat="server">
名称:<asp:TextBox id="name" runat="server" />
<br />
年龄:<asp:TextBox id="age" runat="server" />
<br /><br />
<asp:Button runat="server" Text="提交" />
<br /><br />
<asp:RequiredFieldValidator
ControlToValidate="name"
Text="name 字段是必填的!"
runat="server" />
</form>

</body>
</html>