ASP.NET validation controls

Posted by mehmet6parmak on Stack Overflow See other posts from Stack Overflow or by mehmet6parmak
Published on 2010-05-21T09:48:48Z Indexed on 2010/05/21 9:50 UTC
Read the original article Hit count: 243

Filed under:
|
|

Hi All,

I want to use Validation Controls but I dont want them to show their Error Messages when invalid data exist. Instead I'm going to iterate through the validation controls and show error messages inside my little ErrorMessage Control

for (int i = 0; i < Page.Validators.Count; i++)
        {
            if (!Page.Validators[i].IsValid)
            {
                divAlert.InnerText = Page.Validators[i].ErrorMessage;
                return false;
            }                
        }

I'm doing this because i have little space to show the error message. You can ask why are you using validation control if you dont want to show them My asnwer is "I use them for validation logic they handle"

I looked the properties of the validation controls and cant find something that wil help me doing this.

Any Idea?

Thanks

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about validation