Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old December 17th, 2003, 01:26 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Harrisburg, PA, USA.
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default Custom Validator

Hello,

I'm creating validation on my form by using Custom Validators. I want to have the validator make sure that one of the items in the check box list is checked, but when I go to assign the custom validator's ControlToValidate property, none of the check boxes appear in the list. However, radio buttons do. Is there a way around this?

Thanks,

Brian Mains
__________________
Brian
  #2 (permalink)  
Old December 17th, 2003, 02:28 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , USA.
Posts: 1,111
Thanks: 0
Thanked 3 Times in 3 Posts
Default

one way around it is to have one defaut as to always being checked.

<asp:checkboxlist id="mychkbox" runat="server">
    <asp:listitem text="burger" />
    <asp:listitem text="pizza" selected="true" />
</asp:checkboxlist>

**Note: I used a checkboxlist in the example.

Or you can use a requiredfieldvalidator on the <asp:checkboxlist> control instead of a custom one.

  #3 (permalink)  
Old December 17th, 2003, 04:23 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Harrisburg, PA, USA.
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

I tried to use a required field validator, and the checkbox list control didn't appear in the ControlToValidate property. Also, in the checkbox list control, I want to validate against it because it is possible the user could uncheck the one selected box, which would be an error. Any other ideas?

Thanks.
  #4 (permalink)  
Old December 17th, 2003, 04:35 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , USA.
Posts: 1,111
Thanks: 0
Thanked 3 Times in 3 Posts
Default

You have to add it in. Mine doesn't show up either. So, in my example you have <asp:RequiredFieldValidator ControlToValidate="mychkbox" id="...

  #5 (permalink)  
Old December 18th, 2003, 11:45 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Harrisburg, PA, USA.
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

I did that for the custom validator control, and it said "invalid control specified in the ControlToValidate" property...
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
DDL Custom Validator AspNetGuy BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 2 June 6th, 2008 05:17 PM
Custom Validator against a database Steve Spicer ASP.NET 2.0 Professional 16 January 12th, 2008 06:25 AM
custom validator question kscdave Classic ASP Professional 3 April 24th, 2005 07:11 AM
Custom Validator for Two text box. vickyhere ASP.NET 1.0 and 1.1 Basics 2 October 15th, 2004 06:41 AM



All times are GMT -4. The time now is 05:12 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.