Menu

#31 Validation Control fix

open
nobody
None
5
2014-08-23
2007-12-22
Anonymous
No

In manager.cs, in method ValidationScriptsRequired(Page page)
anther goes througth page validators.

in foreach cycle goes througth page.Validators colletion. But its not collectio of BaseValidators objects, but collection of objects implemented IValidator interface.

Type conversion into BaseValidator is wrong

There is fixed code of this method:

private bool ValidationScriptsRequired(Page page)
{
#if V2
if (page != null && page.Validators.Count > 0 && page.Request.Browser.W3CDomVersion.Major >= 1)
{
foreach (ASP.BaseValidator validator in page.Validators)
{
if (validator.EnableClientScript)
{
if (page.Request.Browser.EcmaScriptVersion.CompareTo(new Version(1, 2)) >= 0)
return true;
}
}
}
return false;
#else
if (page != null && page.Validators.Count > 0 && page.Request.Browser.MSDomVersion.Major >= 4)
{
foreach (ASP.BaseValidator validator in page.Validators)
{
if (validator.EnableClientScript)
{
if (page.Request.Browser.EcmaScriptVersion.CompareTo(new Version(1,2)) >= 0)
return true;
}
}
}
return false;
#endif
}

Discussion


Log in to post a comment.