Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/284.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 我试图给我们一个自定义验证器来检查文本框是否为空,然后向用户显示一条消息,该字段必须填写_C# - Fatal编程技术网

C# 我试图给我们一个自定义验证器来检查文本框是否为空,然后向用户显示一条消息,该字段必须填写

C# 我试图给我们一个自定义验证器来检查文本框是否为空,然后向用户显示一条消息,该字段必须填写,c#,C#,这是我的。我感谢你的建议 protected void CustomValidator4_ServerValidate(object sender, ServerValidateEventArgs e) { string n; e.IsValid = string.Empty(e.Value, out n); } 改用a 你的代码行毫无意义。你需要学习C。 <asp:TextBox id="TextBox1" runat="server"/> <asp:Re

这是我的。我感谢你的建议

protected void CustomValidator4_ServerValidate(object sender, ServerValidateEventArgs e)
{
    string n;
    e.IsValid = string.Empty(e.Value, out n);
}
改用a


你的代码行毫无意义。你需要学习C。
<asp:TextBox id="TextBox1"  runat="server"/>
<asp:RequiredFieldValidator id="RequiredFieldValidator1"
                    ControlToValidate="TextBox1"
                    Display="Static"
                    ErrorMessage="Please enter something here"
                    runat="server"/>