473,320 Members | 1,904 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,320 software developers and data experts.

Mystery with Custom Validation and Calendar control

Hi. I have this elementary function:

Protected Sub ServerValidate(ByVal source As Object, ByVal args As
System.Web.UI.WebControls.ServerValidateEventArgs)

Dim objCustomValidator As CustomValidator
Dim dtChosenDate As Date

objCustomValidator = CType(source, CustomValidator)
dtChosenDate =
CType(objCustomValidator.Parent.FindControl("calSt art"),
Calendar).SelectedDate

'The date must be greater than today: (for now, we'll read the date of
the computer... although we
'should probably read the date of some server):

If DateDiff(DateInterval.Day, dtChosenDate, Now) >= 0 Then
objCustomValidator.Text = "*"
objCustomValidator.ErrorMessage = "The date should be greater than
today!"
args.IsValid = False
Else
args.IsValid = True
End If

objCustomValidator = Nothing
End Sub

On the same page I have a ValidationSummary control:

<asp:ValidationSummary
ID="validSummary"
ShowSummary="False"
DisplayMode="BulletList"
HeaderText="The following data is wrong or missing:"
ShowMessageBox="true"
runat="server"/>

Somehow when I run the code, the * (the red star) is set near the
calendar -
see line
objCustomValidator.Text = "*"
but the error message, although set, is not shown by the
ValidationSummary. The ValidationSummary does its job, preventing me
to leave the page until I select a date in the future, but it does NOT
tell me anything other than making the star visible - the message box
does not even pop up. What could it be ?

PS. The exact same ValidationSummary works great for the other
controls on the form, although, true, those have the .ErrorMessage
property set at design-time.

PS. The same strategy (see code above) works just fine for other
controls, like text-boxes, on other pages, even though those controls
are in a repeater !!!

Thank you very much.
Alex

Feb 6 '07 #1
0 1280

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

Similar topics

1
by: charliewest | last post by:
Is it possible to use the custom validation control to validate a calendar control via client-side script (in jscript)? I'm familiar with custom validation and client side script, and i am aware...
2
by: Caesar Augustus | last post by:
First, let me start by saying my asp.net experience is still in it's infancy so please bare with me as I try to explain my situation. I have created a single page that with the use of many...
6
by: jk | last post by:
Looking through WebUIValidation.js, I discovered that the standard validators don't cater for non-numeric date formats (e.g. dd-MMM-yyyy) which I would like to do To keep code to a minimum, I...
0
by: Pavan | last post by:
My name is Pavan and I am a software engineer working on ASP .Net web development. Currently I am using .Net 2.0 Professional Edition to develop my web pages. I have a problem
0
by: Julien | last post by:
Hi ! I'm creating a custom control, in which I would render an image with client-side script code to display/hide a calendar control which also belong to my custom control. In this control I've...
2
by: Marc Robitaille | last post by:
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...
1
by: Cong | last post by:
Hi I have two unbounded text boxes (startdate and enddate). If I entered the date manually I can can set validation for the text box for example < date() this will works but if I have a...
3
by: mark4asp | last post by:
How can I stop my Calendar control from firing the form validation events? I have a form containing several controls which have several validation controls each. One control is a TextBox...
8
by: Radu | last post by:
Hi. I have an ASP control on my page: <asp:Calendar ID="calStart" ................ Etc </asp:Calendar> and I have a Custom Validator defined as <asp:CustomValidator
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.