摘要:
//说明下 EnableEventValidation="false"的使用; //在页面上添加了输入型服务器控件时(如 TextBox),就需要设置为false了,否则会报错;也就是关闭页面验证,默认是开启的。 //就是这个样子以下是代码片段:<%@ Page Language="C#" EnableEventValidation="false" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %> 以下是代码片段: private void DBExport() { www.sz 阅读全文
摘要:
我将创建一个PriceAttribute来验证某个值是否大于指定的价格,并且这个价格必须以99分结束,因此$20.00是无效的值,$19.99是有效的。下面是这个属性的代码:以下是代码片段:public class PriceAttribute : ValidationAttribute { public double MinPrice { get; set; } public override bool IsValid(object value) { if (value == null) { return true; } var price = (double)value; if (pric 阅读全文