how to do validation in cshtml (MVC)
-
Tuesday, December 27, 2011 10:58 AM
Hi,
I have created one form in cshtml.
I need to validate some fields in the form.(like name, postal code, phone number)
Can anyone pls tell me how to do this? can we do it using javascript?
All Replies
-
Wednesday, December 28, 2011 8:57 AMModerator
Hi karthiga,
You can get all your concerns on MVC View Model validation settled after learning this wonderful blog(tutorial): Some new features of MVC2 enforces validation logic on models/viewmodels significantly easier. These features are designed so that the validation logic is always enforced on the server, and can optionally also be enforced on the client via JavaScript.
ASP.NET MVC 2: Model Validation: http://weblogs.asp.net/scottgu/archive/2010/01/15/asp-net-mvc-2-model-validation.aspx.
I am afraid this forum is not what you want, what you wanna is the official MVC Forum here: http://forums.asp.net/1146.aspx/1?MVC.
If the provided links could not fulfill your requirement, please close this thread and create a new one there in that forum to get dedicated support.
Thanks for your understanding.
Have a nice day,
Leo Liu [MSFT]
MSDN Community Support | Feedback to us
- Marked As Answer by Leo Liu - MSFTModerator Monday, January 09, 2012 6:02 AM

