Click here to Skip to main content
Licence 
First Posted 14 Jun 2006
Views 9,956
Downloads 67
Bookmarked 11 times

Validate Multi objects in Asp.Net

Validate Multi Objects in Form
2 votes, 100.0%
1

2

3

4

5
1.00/5 - 2 votes
μ 1.00, σa 1.10 [?]

Introduction

 In my projects i need validate many information like valid date, item selected...etc. to don´t create some if and else in code i created a simple class to validate this objects. I send objects, message error to return and the validation type. After process the class return a arraylist with messages error case this object don´t is true.
 The class can to be modified to change color object, change text color or other client information.

How To Use The Code

 I send a project with code how to use this class.

 1 - Create new instance of the class

  CheckObjects oCheckObjects = new CheckObjects();
 

2 - Add Object for Analyze

  oCheckObjects.AddObjectForAnalyze(Object,MessageError, TypaValidation);
 3 - Call Method To Analyze And Add To ArrayList The return.
  oArrayList = oCheckObjects.ProcessAnalyze();

 4 - Show Message Error

         if (oArrayList.Count > 0)
         {
             foreach (String aString in oArrayList)
             {
                 vErrorMensage += " - " + aString + "<A href="file://\\n">\\n</A>";
             }
             ClientScript.RegisterClientScriptBlock(Page.GetType(), "Error", "<script>function MessageError(){\n alert(\"Check Objects below:\\n " + vErrorMensage + "\");\n}</script>");
             Body.Attributes.Add("onload", "MessageError()");

             return;
         }

 

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

leandro Ikezili

Web Developer

Brazil Brazil

Member


Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
-- There are no messages in this forum --
Permalink | Advertise | Privacy | Mobile
Web01 | 2.5.120210.1 | Last Updated 14 Jun 2006
Article Copyright 2006 by leandro Ikezili
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid