By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,988 Members | 1,049 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,988 IT Pros & Developers. It's quick & easy.

.NET validation controls and custom web control

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.