473,398 Members | 2,368 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

Validating a CheckBox with ASP.NET validators?

Hi

How do I validate a CheckBox with a formvalidator from ASP.NET ? I can't
find anyway to do it and I need the look of this validation to look like the
rest of the textbox validators on the form (which are using
RequiredFieldValidators). Please help!

Best Regards
/Lars
Nov 19 '05 #1
3 1187
Hi!

You have to decide _what_ to validate on the CheckBox. I did this recently,
but there is no automagic way to validate a boolean. :) IE. it could be that
you wanted it not to be checked off. (Who does..)
What I did was to use a CustomValidator with a client side script checking
if the checkbox is checked. I think there is an example in the .net framework
documentation for CustomValidator. If you can't find it, give me a hint and
I'll provide the example here. (Got it on another computer ;) )

HTH,
Lars-Erik

"Lars Netzel" wrote:
Hi

How do I validate a CheckBox with a formvalidator from ASP.NET ? I can't
find anyway to do it and I need the look of this validation to look like the
rest of the textbox validators on the form (which are using
RequiredFieldValidators). Please help!

Best Regards
/Lars

Nov 19 '05 #2
I made my own check instead. Doesnt' look the same but it work. Thanx anyway

/Lars
"Lars-Erik" <la**************@HATESPAMmarkedspartner.no> wrote in message
news:E8**********************************@microsof t.com...
Hi!

You have to decide _what_ to validate on the CheckBox. I did this
recently,
but there is no automagic way to validate a boolean. :) IE. it could be
that
you wanted it not to be checked off. (Who does..)
What I did was to use a CustomValidator with a client side script checking
if the checkbox is checked. I think there is an example in the .net
framework
documentation for CustomValidator. If you can't find it, give me a hint
and
I'll provide the example here. (Got it on another computer ;) )

HTH,
Lars-Erik

"Lars Netzel" wrote:
Hi

How do I validate a CheckBox with a formvalidator from ASP.NET ? I can't
find anyway to do it and I need the look of this validation to look like
the
rest of the textbox validators on the form (which are using
RequiredFieldValidators). Please help!

Best Regards
/Lars

Nov 19 '05 #3
You'll need to use a CustomValidator control. You can provide client side
javascript in addition to your server validation event.

-Brock
DevelopMentor
http://staff.develop.com/ballen
Hi

How do I validate a CheckBox with a formvalidator from ASP.NET ? I
can't find anyway to do it and I need the look of this validation to
look like the rest of the textbox validators on the form (which are
using RequiredFieldValidators). Please help!

Best Regards
/Lars


Nov 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Asha | last post by:
greetings i want to use the required field validator control to validate a checkbox. here is the code implemented. <asp:RequiredFieldValidator ID="rfv" ControlToValidate="chkDistiAudit"...
4
by: Joe Abou Jaoude | last post by:
hi I m facing the following problem often : In a web page the user can click on 2 buttons "button1" and "button2". If the user clicked on button1 then I have to validate part of the form (some...
7
by: mc | last post by:
I've not been able to get a Check box to client side validated on postback. with my changes I can get it to work on the serverside ok but not on the client. I have created a new control as...
76
by: Michael Stemper | last post by:
The W3C Validator is a great help, as far as it goes. However, I'm looking for something stricter. My coding style does not allow for implicit termination of an element; my intention and desire is...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.