Tech Off Thread

2 posts

Excluding Validator From Validation Summary

Back to Forum: Tech Off
  • User profile image
    MetaGunny

    I can't find any methods or properties to exclude a validator from being included in the validation summary.  Anyone know how to do this?  I'm thinking about writing my own validation summary in a sense to get around this, but though I'd check to see if there is a built-in method.

    I want to have a red asterisk next to the textbox that has the error, and then the error message in the validation summary.

  • User profile image
    Benjamim

    If i understand your problem, you have some validators in a page and just some of them should show their validation message in the validation summary...

    You can use the ValidationGroup property. Define it in the validation summary and in the validators you want to show the error messages.

    <asp:RequiredFieldValidator ... ValidationGroup="group1">*</asp:RequiredFieldValidator> // 1
    <asp:RequiredFieldValidator ... ValidationGroup="group2">*</asp:RequiredFieldValidator> // 2

    <asp:ValidationSummary ... ValidationGroup="group1" />

    In this case, only the validator 1 error message will be shown in the validation summary.

    Hope this solves your problem Smiley

    (sorry about my english...i'm portuguese Wink )

Comments closed

Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation, please create a new thread in our Forums, or Contact Us and let us know.