"Maarten" <No****@me.com> wrote in message
news:OO*************@TK2MSFTNGP09.phx.gbl...
protected void Page_Load(object sender, EventArgs e)
{
Page.Validate();
}
<se********@gmail.com> wrote in message
news:11*********************@e56g2000cwe.googlegro ups.com...I want the little "*" error message that displays next to a text box of
my validation to display when the page loads NOT on the button click so
that the user knows what fields are required BEFORE the try to save the
form.....Im sure this is obvious but I could not find the answer any
help greatly appreciated.
This will work but has a drawback. If you use this, and also have a
ValidationSummary control on your page, the errors will be listed on the
first page load, instead of just postbacks. If you do have a
ValidationSummary control on the page, then what you can do is set the
Display property of the Validation control(s) you are using to "None".
Place a label (styled) next to the controls that you are validating with an
'*' char as the text. This way, the '*' are always visible (styled to Red
forecolor if you so desire) and the error messages are only displayed in the
ValidationSummary on a validation check. You would no longer need
Page.Validate() in your Page_Load event.
HTH,
Mythran