Skip to content

Ozar.net Developer Blog

Programming in PHP, C, C#, ASP.NET, Java, Objective-C, SQL also for MS SQL Server, Oracle & MySQL Development

Menu
  • Home
  • About
  • Tutorials
  • Contact
  • Privacy
Menu

Validating ASP.NET checkbox (and similar) controls.

Posted on April 13, 2010April 14, 2010 by OD


blog.dmbcllc.com There are controls in the .NET framework that can not be wired to the standard validation controls. The checkbox control is one example. You can’t use the requiredfieldvalidator because it has a value. It’s either true or false. And you can’t provide a regularexpressionvalidator or one of the others because it is a boolean value. So, if I want to make sure a check box is checked before the user continues, for example. And, I want to make sure that the error message shows up in the error summary control like every other error, how do I do that?

11 thoughts on “Validating ASP.NET checkbox (and similar) controls.”

  1. jono1978xyz2008 says:
    April 13, 2010 at 11:48 PM

    Thank you. Very helpful!

    Log in to Reply
  2. davidmbush says:
    April 13, 2010 at 11:59 PM

    You shouldn’t be using the “ControlToValidate” property. It isn’t needed and it WILL cause an error if you do. This was covered in the video

    Log in to Reply
  3. LeperKing says:
    April 14, 2010 at 12:38 AM

    .Net FAIL

    Control ‘CheckBox27’ referenced by the ControlToValidate property of ‘CustomValidator1’ cannot be validated.

    Log in to Reply
  4. weenoid says:
    April 14, 2010 at 1:35 AM

    great tutorial, thanks

    Log in to Reply
  5. tlsonger says:
    April 14, 2010 at 2:00 AM

    Do you have any examples of validating checkboxlists using a custom validator and vb?

    Log in to Reply
  6. imrancsi says:
    April 14, 2010 at 2:55 AM

    thank u so much..great post

    Log in to Reply
  7. vklalbeg says:
    April 14, 2010 at 3:28 AM

    Excellent

    Log in to Reply
  8. hombresabana says:
    April 14, 2010 at 3:50 AM

    Thanks!
    Gracias!
    from Argentina.

    Log in to Reply
  9. lasflores147 says:
    April 14, 2010 at 4:34 AM

    thank you

    Log in to Reply
  10. darnellmoneywilliams says:
    April 14, 2010 at 5:16 AM

    Thank you very much for the information, but why wouldn’t you just use:

    args.IsValid = Checkbox1.Checked

    Seems much simpler.

    Anyway, thanks again.

    Log in to Reply
  11. michelAtPionet says:
    April 14, 2010 at 5:21 AM

    Very nice
    thank you!

    Log in to Reply

Leave a Reply Cancel reply

You must be logged in to post a comment.

Recent Posts

  • NSTableView with Core Data Tutorial using NSFetchedResultsController
  • CodeIgniter Wizard – a new PHP CRUD Code Generator for macOS
  • Installing Oracle Database 10g Express Edition and Changing the Default HTTP Port
  • Xcode Tutorial 2 – Putting iAd into your App (The Apple Approved Way)
  • Cocoa Programming: A Quick-Start Guide for Developers

Blogroll

  • All Systems GO
  • GOZmosis
  • Maclord's Blog
  • Ozar.net

Tags

.NET 2008 application ASP.NET basic Beginning best books business Business Objects C# Database Databases Development Edition Guide iPhone Java Java EE learn Learning Microsoft MS SQL Server MySQL Objective-C Programming objects Oracle Part PHP PL/SQL Professional Programming Server Software SQL T-SQL TSQL Tutorial Tutorials Using Video Visual Visual Basic .NET Web Programming Tutorials XCode
© 2025 Ozar.net Developer Blog | Powered by Minimalist Blog WordPress Theme