473,405 Members | 2,185 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,405 software developers and data experts.

requiredvalidator for checkbox

Is there no way to require a checkbox to be checked in ASP.NET?
The requiredvalidator control doesn't work for it--should I make a
server--roundtrip for that and check during the btn_click event? Is there
another way?

Thanks,
Shane
Nov 17 '05 #1
3 2919
I've used a CustomValidator, and wrote some client side javascript to do
this type of check. That way you will avoid the roundtrip.

You could just as easily forgo the validators, and just write your own
routine for this, but I had some other validators on the page that were
being displayed in a validation summary, so it was more convenient.

"SStory >" <Sh*********@online.msn.com <remove the 'online.' to send me
mail> wrote in message news:eu**************@TK2MSFTNGP11.phx.gbl...
Is there no way to require a checkbox to be checked in ASP.NET?
The requiredvalidator control doesn't work for it--should I make a
server--roundtrip for that and check during the btn_click event? Is there
another way?

Thanks,
Shane

Nov 17 '05 #2
custom validators do not require you to set that property. You can leave it
blank. Be sure to define a javascript function, and list it in the property
that speficies which client side function to run for the validation.

"SStory >" <Sh*********@online.msn.com <remove the 'online.' to send me
mail> wrote in message news:ew**************@TK2MSFTNGP10.phx.gbl...
Yeah I know, but when I click ControlToValidate for, the checkbox controls
don't list????

How did you handle that?

"Marina" <zl*******@nospam.hotmail.com> wrote in message
news:er*************@tk2msftngp13.phx.gbl...
I've used a CustomValidator, and wrote some client side javascript to do
this type of check. That way you will avoid the roundtrip.

You could just as easily forgo the validators, and just write your own
routine for this, but I had some other validators on the page that were
being displayed in a validation summary, so it was more convenient.

"SStory >" <Sh*********@online.msn.com <remove the 'online.' to send me
mail> wrote in message news:eu**************@TK2MSFTNGP11.phx.gbl...
Is there no way to require a checkbox to be checked in ASP.NET?
The requiredvalidator control doesn't work for it--should I make a
server--roundtrip for that and check during the btn_click event? Is there another way?

Thanks,
Shane



Nov 17 '05 #3
Muchas gracias! :)

I am very glad that someone answered that question for me.

Shane

"Marina" <zl*******@nospam.hotmail.com> wrote in message
news:OH**************@TK2MSFTNGP09.phx.gbl...
custom validators do not require you to set that property. You can leave it blank. Be sure to define a javascript function, and list it in the property that speficies which client side function to run for the validation.

"SStory >" <Sh*********@online.msn.com <remove the 'online.' to send me
mail> wrote in message news:ew**************@TK2MSFTNGP10.phx.gbl...
Yeah I know, but when I click ControlToValidate for, the checkbox controls don't list????

How did you handle that?

"Marina" <zl*******@nospam.hotmail.com> wrote in message
news:er*************@tk2msftngp13.phx.gbl...
I've used a CustomValidator, and wrote some client side javascript to do this type of check. That way you will avoid the roundtrip.

You could just as easily forgo the validators, and just write your own
routine for this, but I had some other validators on the page that were being displayed in a validation summary, so it was more convenient.

"SStory >" <Sh*********@online.msn.com <remove the 'online.' to send me mail> wrote in message news:eu**************@TK2MSFTNGP11.phx.gbl...
> Is there no way to require a checkbox to be checked in ASP.NET?
> The requiredvalidator control doesn't work for it--should I make a
> server--roundtrip for that and check during the btn_click event? Is

there
> another way?
>
> Thanks,
> Shane
>
>



Nov 17 '05 #4

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

Similar topics

4
by: Fabri | last post by:
How can I, on button click, to select ONLY the following 4 checkbox? I would like to do this without a for loop through form.lenght because this is only an example and I have to apply this script...
4
by: feanor | last post by:
I need to select children checkboxes when selecting the parent one. This is my function: function SelectChildrens(checkbox_name){ form = document.forms; Sname = checkbox_name.split("-"); for...
0
by: mike | last post by:
Hi there: I've read an excellent "how to"-article by Microsoft (no. 306227) - partly cited cited at the end of this email). I have implemented the code related to the part "How to Add a...
2
by: bebop | last post by:
I'm using three checkbox web controls in C# .NET and one button, and one labe Is there a way to "group" these individual checkbox web controls If so, do I use a for loop, hashtable, array,...
5
by: DotNetJunkies User | last post by:
1. i want to populate checkboxlist using javascript only at client side ....how can i do this..by populate word i mean that checkboxes should be checked or unchecked on some condition basis.......
3
by: TJS | last post by:
I am finding that the serverside requiredvalidator doesn't fire in the firefox browser, and user request proceeds through to my updateProfile method. Validation is working correctly in the IE...
4
by: Shimon Sim | last post by:
hi It should be easy but I can't make it work. I have DropDownList. I set first with text and value "Select". Then I add RequiredValidator and set it InitialValue to "Select" and I expect that the...
10
by: rn5a | last post by:
All the rows in a DataGrid, including the Header, are accompanied with a CheckBox. I want that when the CheckBox in the Header is checked, then all the CheckBoxes should automatically get checked....
0
by: cyberdawg999 | last post by:
Greetings all in ASP land I have overcome one obstacle that took me 2 weeks to overcome and I did it!!!!! I am so elated!! thank you to all who invested their time and energy towards helping me...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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?
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.