验证控件无效

时间:2016-04-01 18:05:03

标签: asp.net visual-studio web-services asp.net-validators

我在Windows 10上使用visual studio 2012.当我在网络表单中使用验证时,它显示已添加验证(在设计视图中),但是当我在浏览器中打开时它没有显示任何内容。帮助

var html = <svg>whatever on svg </svg>
var fileName = "myfile.svg";
var blob = new Blob([html], {type: 'image/svg'});
blob.lastModifiedDate = new Date();
// var blobAttrs = {type: "image/svg"};
// var file = new File([html], fileName, blobAttrs);
var formData = new FormData();
formData.append("file",blob,fileName);

1 个答案:

答案 0 :(得分:0)

您必须定义Text的{​​{1}}属性才能在验证失败时看到标记:

CustomValidator

要查看错误消息,您应在表单中添加<asp:CustomValidator id="CustomValidator1" runat="server" Text="*" ... />

ValidationSummary

最后,在<asp:ValidationSummary ID="ValidationSummary1" runat="server" DisplayMode="List" /> 函数中,您应该在测试之前将validateNumber参数转换为数字:

Value