Updated validation in Web Pages v2

Posted by: mikes web log, on 08 Feb 2012 | View original | Bookmarked: 0 time(s)

In v1 of ASP.NET Web Pages, you could add user-input validation by doing something like this in code:if (name.IsEmpty()) {    ModelState.AddError("Name", "You must enter a name.");}In v2, there's a new Validation helper that has some nifty features:Methods to check for required fields, data types, string length, numeric ranges, the same values in two fields (as for new passwords), and patterns (i.e., RegEx).Methods to display both field-specific and summary validation error messages.Both...

Advertisement
Free Agile Project Management Tool from Telerik
TeamPulse Community Edition helps your team effectively capture requirements, manage project plans, assign and track work, and most importantly, be continually connected with each other.
Category: Regex | Other Posts: View all posts by this blogger | Report as irrelevant | View bloggers stats | Views: 287 | Hits: 19

Similar Posts

  • Updated validation in Web Pages v2, Part 2 more
  • Updated validation in Web Pages v2, Part 3 more

News Categories

.NET | Agile | Ajax | Architecture | ASP.NET | BizTalk | C# | Certification | Data | DataGrid | DataSet | Debugger | DotNetNuke | Events | GridView | IIS | Indigo | JavaScript | Mobile | Mono | Patterns and Practices | Performance | Podcast | Refactor | Regex | Security | Sharepoint | Silverlight | Smart Client Applications | Software | SQL | VB.NET | Visual Studio | W3 | WCF | WinFx | WPF | WSE | XAML | XLinq | XML | XSD