Proprietà FormToValidate

Imposta o restituisce l'identificatore del controllo Form da convalidare. Il valore predefinito è una stringa vuota ("").

public string FormToValidate {
   get,
   set
}

Osservazioni

Se si intende utilizzare la convalida, questa proprietà deve contenere un valore che rappresenti un ID di form valido.

Esempio

Nell'esempio che segue viene illustrato come utilizzare la proprietà FormToValidate per specificare Form1 come form da convalidare.

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
   
 ' ErrorMessages appear in ValidationSummary.
RequiredFieldValidator1.ErrorMessage = "User name is required"
RequiredFieldValidator2.ErrorMessage = "Password is required"

'Give the ID of Form that has to validate.
ValidationSummary1.FormToValidate = "Form1"
 
End Sub

[C#]
void Page_Load(Object sender, EventArgs e)
{
   // ErrorMessages appear in ValidationSummary.
   RequiredFieldValidator1.ErrorMessage = "User name is required";
   RequiredFieldValidator2.ErrorMessage = "Password is required";

   //Give the ID of Form that has to validate.
   ValidationSummary1.FormToValidate="Form1";
}  

Vedere anche

Si applica a: classe ValidationSummary