By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,728 Members | 2,414 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,728 IT Pros & Developers. It's quick & easy.

Validationsummary

P: n/a
Is there a way to reference the value of a validationsummary control? I have
a need to display any validation errors on my pages in a unique way and the
normal output of the validationsummary control does not meet that
requirement. However if I were able to capture the output that the
validationsummry writes to the screen, into a string variable that would most
likely solve my problem. Any one have any ideas?
Nov 18 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
sure, create your own validation summary that inherits from the default one,
and change the error display. if you change it very much, you will need to
update webuivalidation.js to support your output.

-- bruce (sqlwork.com)
"Mike" <Mi**@discussions.microsoft.com> wrote in message
news:C6**********************************@microsof t.com...
| Is there a way to reference the value of a validationsummary control? I
have
| a need to display any validation errors on my pages in a unique way and
the
| normal output of the validationsummary control does not meet that
| requirement. However if I were able to capture the output that the
| validationsummry writes to the screen, into a string variable that would
most
| likely solve my problem. Any one have any ideas?
Nov 18 '05 #2

P: n/a
One way to do this is to loop through the validators collection of the
page and retrieve the error messages directly. Here's a bit of code
that does this:

foreach (Control currentControl in this.Page.Validators)
{
IValidator currentValidator = currentControl as IValidator;
if (currentValidator != null)
{
if (!currentValidator.IsValid)
{
Label currentValidationMessage = new Label();
currentValidationMessage.Text = currentValidator.ErrorMessage;
//Do something with the label here
}
}
}

I snipped this out of a custom validation summary control that I
developed for the same reason that you specified. Hope it helps.

Have A Better One!

John M Deal, MCP
Necessity Software
bruce barker wrote:
sure, create your own validation summary that inherits from the default one,
and change the error display. if you change it very much, you will need to
update webuivalidation.js to support your output.

-- bruce (sqlwork.com)
"Mike" <Mi**@discussions.microsoft.com> wrote in message
news:C6**********************************@microsof t.com...
| Is there a way to reference the value of a validationsummary control? I
have
| a need to display any validation errors on my pages in a unique way and
the
| normal output of the validationsummary control does not meet that
| requirement. However if I were able to capture the output that the
| validationsummry writes to the screen, into a string variable that would
most
| likely solve my problem. Any one have any ideas?

Nov 18 '05 #3

P: n/a
Thank you very much, your response is most helpful.

"John M Deal" wrote:
One way to do this is to loop through the validators collection of the
page and retrieve the error messages directly. Here's a bit of code
that does this:

foreach (Control currentControl in this.Page.Validators)
{
IValidator currentValidator = currentControl as IValidator;
if (currentValidator != null)
{
if (!currentValidator.IsValid)
{
Label currentValidationMessage = new Label();
currentValidationMessage.Text = currentValidator.ErrorMessage;
//Do something with the label here
}
}
}

I snipped this out of a custom validation summary control that I
developed for the same reason that you specified. Hope it helps.

Have A Better One!

John M Deal, MCP
Necessity Software
bruce barker wrote:
sure, create your own validation summary that inherits from the default one,
and change the error display. if you change it very much, you will need to
update webuivalidation.js to support your output.

-- bruce (sqlwork.com)
"Mike" <Mi**@discussions.microsoft.com> wrote in message
news:C6**********************************@microsof t.com...
| Is there a way to reference the value of a validationsummary control? I
have
| a need to display any validation errors on my pages in a unique way and
the
| normal output of the validationsummary control does not meet that
| requirement. However if I were able to capture the output that the
| validationsummry writes to the screen, into a string variable that would
most
| likely solve my problem. Any one have any ideas?

Nov 18 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.