Validating checkboxes in asp net Adult chat lines in austin
18-Oct-2020 04:21
Here is my code from my custom validator can you spot any errors?
protected void Page_Load(object sender, Event Args e) protected void cv Agree_Server Validate(object source, Server Validate Event Args args) Patrice wrote: Well a checkbox is basically either checked or unchecked so having the special case were the user has to check the checkbox were likely not MS top priority (my understainding is that you want to display a checkbox that is necessarily checked).
I have created a new control as below:-[Validation Property("Validation Value")]public class Validifiable Check Box: Check Boxthis gives me a Check Box that the Validators will except (rather thanthrowing an exception about not being able to validate them), If I use IMO the problem is that the checkbox input control doesn"t have a value property. IMO you should use somewhere the checked property (and you'll have to get this value by yourself).
-- Patrice "mc" Thanks for your response, Whilst waiting for a response I've already investigated the custom validator, however, when I try to get the "args.
That's okay so far because bool is a value type and never null.
But even if I make Agrees With Terms nullable it won't work because the compiler shouts "Templates can be used only with field access, property access, single-dimension array index, or single-parameter custom indexer expressions." So, what's the correct way to handle this?
I have created a new control as below:- [Validation Property("Validation Value")] public class Validifiable Check Box: Check Box this gives me a Check Box that the Validators will except (rather than throwing an exception about not being able to validate them), If I use it with a Required Field Validator, the Serverside events valdiation works however it doesn't seem to trap it on the client, my page code is bellow: - Thanks for your response, Whilst waiting for a response I've already investigated the custom validator, however, when I try to get the "args.
NET Check Box control, it does be a particular one which can not be used directly by any built-in validators except the Custom Validator control.
Thanks MC Steven Cheng[MSFT] wrote: Hi MC, As for ASP.
-------------------- is fine but AFAIK you have to provide client side validation code if youwant to validate this client side (server side code runs server side andcan't be run or won't be transformed automatically for the client sidehandling).--Patrice "mc" 47********@mail.uk...
-- Patrice "mc" I've not been able to get a Check box to client side validated onpostback.
with my changes I can get it to work on the serverside ok butnot on the client.with my changes I can get it to work on the serverside ok but not on the client.