Click here to Skip to main content
15,881,768 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to perform validation for user input in 3 tier c# windows application.
Where is the exact place to place the validation code (i.e. in presentation layer or BAL) and display appropriate massage related to it.

Eg:

if()
{
//errormessage..............
}
else
{
//ok......................
}

Please suggest solution along with sample code

What I have tried:

if()
{
//errormessage..............
}
else
{
//ok......................
}
Posted
Updated 29-Feb-16 17:35pm
Comments
vipan.net 1-Mar-16 0:19am    
Best way of implementing validation in presentation layer. and which type of example you are looking ( like: required) . if you explain, i will provide you .

1 solution

Hi Jayesh,

What are the validations you want to perform ?

Input validation may or may not require a metadata to validate. In case your validations require metadata to validate, then you might want to keep your validation in Business Layer as the validations are also part of your business.

If your input validations is a simple Non-empty / Range / Valid characters, then probably you can keep the validations part of Presentation layer.

Thanks !
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900