HeaderText Property

Sets or returns the text that will appear in the heading section of the validation summary page. The default value is String.Empty.

public string HeaderText {
   get,
   set
}

Remarks

If you are developing in HTML, the ValidationSummary page renders the value of the HeaderText property first. When the validation process invalidates a form, it produces a list of ErrorMessage properties for each validator. Each instance of an ErrorMessage property in the list results in an error on the invalid form. This list of errors is followed by a Link control that targets the invalid form. The text of the link is the value of the BackLabel property.

The display of errors for WML 1.1 is similar to HTML, except that the HeaderText property is displayed as plain WML text followed by each error message and preceded by "- " (a hyphen followed by a space).

Example

The following example demonstrates how to use the HeaderText property to overwrite the default text of the header text in the ValidationSummary control.

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
   
Dim currentCapabilities As MobileCapabilities = CType(Request.Browser, MobileCapabilities)
   
   ' Change the dafault text of the header text in a
   ' ValidationSummary control.
   ValidationSummary1.HeaderText = "Summary of Errors"
 
End Sub

<mobile:form runat="server" id="Form2">
<mobile:ValidationSummary runat=server id="ValidationSummary1" 
    BackLabel="Back to Main Form" FormToValidate="Form1" />
</mobile:form>


[C#]

void Page_Load(Object sender, EventArgs e)
{
   // Change the dafault text of the header text in a
   // ValidationSummary control.
   ValidationSummary1.HeaderText="Summary of Errors";
}
<mobile:form runat="server" id="Form2">
<mobile:ValidationSummary runat=server id="ValidationSummary1" 
    BackLabel="Back to Main Form" FormToValidate="Form1" />
</mobile:form>

See Also

Applies to: ValidationSummary Class