RequiredFieldValidator 控件
RequiredFieldValidator 控件确保必需字段不为空。它通常绑定到文本框以强制输入文本框。
控件的语法如下:
<asp:RequiredFieldValidator ID="rfvcandidate"
runat="server" ControlToValidate ="ddlcandidate"
ErrorMessage="Please choose a candidate"
InitialValue="Please choose a candidate">
</asp:RequiredFieldValidator>