For Disable validation controls in a page
public void DisableAllValidations(ControlCollection cntrls)
{
foreach (Control ctrl in cntrls)
{
if (ctrl is CompareValidator)
((CompareValidator)ctrl).Enabled = false;
if (ctrl is CustomValidator)
((CustomValidator)ctrl).Enabled = false;
if (ctrl is RangeValidator)
((RangeValidator)ctrl).Enabled = false;
if (ctrl is RegularExpressionValidator)
((RegularExpressionValidator)ctrl).Enabled = false;
if (ctrl is RequiredFieldValidator)
((RequiredFieldValidator)ctrl).Enabled = false;
DisableForm(ctrl.Controls);
}
}
For Enable validation controls in a page
public void DisableAllValidations(ControlCollection cntrls)
{
foreach (Control ctrl in cntrls)
{
if (ctrl is CompareValidator)
((CompareValidator)ctrl).Enabled = true;
if (ctrl is CustomValidator)
((CustomValidator)ctrl).Enabled = true;
if (ctrl is RangeValidator)
((RangeValidator)ctrl).Enabled = true;
if (ctrl is RegularExpressionValidator)
((RegularExpressionValidator)ctrl).Enabled = true;
if (ctrl is RequiredFieldValidator)
((RequiredFieldValidator)ctrl).Enabled = true;
DisableForm(ctrl.Controls);
}
}