简单教程
提交运行
代码编辑器:
<!DOCTYPE html> <meta charset="utf-8"> <form runat="server"> Name: <asp:TextBox id="name" runat="server" /> <br> Age: <asp:TextBox id="age" runat="server" /> <br><br> <asp:Button runat="server" Text="Submit" /> <br><br> <asp:RequiredFieldValidator ControlToValidate="name" Text="The name field is required!" runat="server" /> </form>
运行结果: