地方激活,怎么调用,要看客户的需求了,这个地方需要调用 vc.Checked(string groupName)来生成js调用代码!
没有这一步的话,程序只会为失去焦点做验证,提交的时候当然就不会做了!
说了蛮多的,不过感觉就是没说清楚!
具体的实现,我挑一两个方法贴出来,更详细的就下载下面的源码吧!最近一直没时间改,这个写了 个把月了,一起没有把现在有的问题更新!
不哆嗦了,看代码:
验证器的其中一个验证项方法:
#region 验证数字(int,double)
/// <summary>
/// 验证数字(int,double)
/// </summary>
/// <param name="errorMessage">错误提示字符串</param>
/// <returns></returns>
public Validator<T> Double(string errorMessage)
{
tempJsonString = new StringBuilder();
tempJsonString.Append("Double:{");
tempJsonString.Append(ConvertToJsonElement("Msg", errorMessage));
tempJsonString.Append("}");
jsonList.Add(tempJsonString.ToString());
//判断是否需要忽略验证
if (ignore)
return this;
//验证
if (!IsPattern(validatorRegexs[2]))
{
this.Reject(errorMessage);
}
return this;
}
#endregion
刮屬否匂議?
using System;
using System.Collections.Generic;
using System.Text;
using Validator;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Security.Permissions;
namespace Validator
{
[AspNetHostingPermission(SecurityAction.Demand, Level = AspNetHostingPermissionLevel.Minimal)]
public class ValidatorContainer : IObserver
{
/// <summary>
/// 頁倦蝕尼刮屬
/// </summary>
private bool isStartCheck;
/// <summary>
/// 刮屬匂侭壓匈斤?
/// </summary>
private Page cPage;
/// <summary>
/// 人薩極刮屬匂斤?兆
/// </summary>
private string clientValidatorName;
/// <summary>
/// 刮屬怏兆
/// </summary>
private string groupName;
/// <summary>
/// 危列方楚
/// </summary>
//private int errorCount;
/// <summary>
/// 念岬格?重云旗鷹
/// </summary>
private StringBuilder renderString;
/// <summary>
/// 刮屬匂双燕
/// </summary>
private List<ISubject> validatorList;
/// <summary>
/// 頁倦蝕
|