473,473 Members | 1,819 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

.NET validation controls and custom web control

Hello,

I built myself a calendar control. I want the control to be able to be
validated by .NET validation controls. So I added the
ValidationPropertyAttribute("Text") to my class declaration of my calendar
control. It is the Text property of my control which must be validated. I
add a CompareValidator control to my web page and I adjust the properties of
this control to validate my calendar control. I use a CompareValidator to
ensure me that it is well a date which is seized in my control. When I
seized a date, that seems to function but if I seized anything other that a
date, the error message of the compareValidator is not showing on my web
page. What do I have to do so my calendar control can be validated by .NET
validation controls?

excuse my bad english :-)
Thank you
--
Marc R.
E-mail
Dim strAddr As String =Convert.ToString(String.Format("{0}.{2}@{3}.{1}",
"mxrc", "cx", "robitxille", "xrs-solutions")).Replace("x", "a")
Feb 21 '06 #1
2 1708
By design, the CompareValidator will not evaluate when the ControlToValidate
returns an empty string. Most likely, when there is no selection on your
calendar, you are returning this. Its a good idea to return the empty
string. So leave that alone. Instead, add the RequiredFieldValidator just
like you would for an ordinary textbox.

--- Peter Blum
www.PeterBlum.com
Email: PL****@PeterBlum.com
Creator of "Professional Validation And More" at
http://www.peterblum.com/vam/home.aspx
"Marc Robitaille" <ma*******@videotron.caa> wrote in message
news:%2******************@TK2MSFTNGP10.phx.gbl...
Hello,

I built myself a calendar control. I want the control to be able to be
validated by .NET validation controls. So I added the
ValidationPropertyAttribute("Text") to my class declaration of my calendar
control. It is the Text property of my control which must be validated. I
add a CompareValidator control to my web page and I adjust the properties
of this control to validate my calendar control. I use a CompareValidator
to ensure me that it is well a date which is seized in my control. When I
seized a date, that seems to function but if I seized anything other that
a date, the error message of the compareValidator is not showing on my web
page. What do I have to do so my calendar control can be validated by .NET
validation controls?

excuse my bad english :-)
Thank you
--
Marc R.
E-mail
Dim strAddr As String =Convert.ToString(String.Format("{0}.{2}@{3}.{1}",
"mxrc", "cx", "robitxille", "xrs-solutions")).Replace("x", "a")

Feb 22 '06 #2
I have allready try this. If I enter 2005-12-31, it is ok. If I enter
2005-12-49, the error message of the validatoir doesn't show on the web
page. What do I have to do to make my control validate by a .NET validator
object?

p.s.
I have allready add the ValidationPropertyAttribute attribute to my class.

Marc R.

"Peter Blum" <PL****@Blum.info> a écrit dans le message de news:
OR*************@TK2MSFTNGP11.phx.gbl...
By design, the CompareValidator will not evaluate when the
ControlToValidate returns an empty string. Most likely, when there is no
selection on your calendar, you are returning this. Its a good idea to
return the empty string. So leave that alone. Instead, add the
RequiredFieldValidator just like you would for an ordinary textbox.

--- Peter Blum
www.PeterBlum.com
Email: PL****@PeterBlum.com
Creator of "Professional Validation And More" at
http://www.peterblum.com/vam/home.aspx
"Marc Robitaille" <ma*******@videotron.caa> wrote in message
news:%2******************@TK2MSFTNGP10.phx.gbl...
Hello,

I built myself a calendar control. I want the control to be able to be
validated by .NET validation controls. So I added the
ValidationPropertyAttribute("Text") to my class declaration of my
calendar control. It is the Text property of my control which must be
validated. I add a CompareValidator control to my web page and I adjust
the properties of this control to validate my calendar control. I use a
CompareValidator to ensure me that it is well a date which is seized in
my control. When I seized a date, that seems to function but if I seized
anything other that a date, the error message of the compareValidator is
not showing on my web page. What do I have to do so my calendar control
can be validated by .NET validation controls?

excuse my bad english :-)
Thank you
--
Marc R.
E-mail
Dim strAddr As String =Convert.ToString(String.Format("{0}.{2}@{3}.{1}",
"mxrc", "cx", "robitxille", "xrs-solutions")).Replace("x", "a")


Feb 22 '06 #3

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

Similar topics

4
by: Kathy | last post by:
I have a form to generate a report. On the form are several textboxes and a "Generate" button. I would like to have the button grayed (not enabled), unless the data in each of the dependant...
7
by: Paul | last post by:
Hi, I have a form where a user is required to enter a start date and an end date. Both are required and must between a specific date range (e.g. 01/01/1900 and 01/01/2099) and the end date...
2
by: Barbara Alderton | last post by:
I setup some standard Required Field Validation controls and one Custom validation control on an ASP.NET page (within a user control) to validate text entry. I also setup a Summary Control to post...
1
by: Stephen Adam | last post by:
Hi there, I have written a custom validation control which checks to see of an input field is not empty and contains only numeric data. I was using a regular expression validation control but...
9
by: AFN | last post by:
I was just dropped into someone else's code (isn't that always so fun?). I can't figure out why a custom validation control's server event function is executing. There is nothing (that I see)...
2
by: Tom | last post by:
How is the best way to avoid validation when closing a window? For instance, I have a Windows Forms window which has a validation event for a text box. However, if one enters invalid data in then...
5
by: Kyle | last post by:
On my Development System, all the page validation controls work fine (WinXP Pro + SP2, VS.NET 2003, .NET v1.1.4322). On the Production System, none of the page validation controls are working...
12
by: Dabbler | last post by:
I need to insure that at least one of three phone number fields has a value (requiredfield) but I'm not sure of a way to implement this without server side logic. Is there a way to use the...
1
by: brantman | last post by:
Here is a question that needs to be revisited. I noticed that there are more that a few posts about this in this group and in custom controls. Here is the problem: When inheriting from a...
0
by: tsw_mik | last post by:
I have created a custom control. It has: -label -button -list of textboxes -list of dropdownlists. I want to use a custom validator to perform some validation, but somehow I can't fo it. The...
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
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,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.