 |
| ASP.NET 1.1 As of 10/6/2005, this forum is locked as part of the reorganization described here: http://p2p.wrox.com/topic.asp?TOPIC_ID=35394. No posts have been deleted. Open ongoing discussions from the last week have been moved to either ASP.NET 1.0 and 1.1 Beginners http://p2p.wrox.com/asp-net-1-0-1-1-basics-60/ or ASP.NET 1.0 and 1.1 Professional. http://p2p.wrox.com/forum.asp?FORUM_ID=50. See my sticky post inside for more. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the ASP.NET 1.1 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

April 9th, 2004, 07:58 AM
|
|
Friend of Wrox
|
|
Join Date: Oct 2003
Posts: 218
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Want the codebehind, too?
- - - - - - - - - - - - - - - - - - - - - - -
In God we trust, everything else we test.
|
|

April 9th, 2004, 08:01 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Not yet. I'll take a quick look at this (unless you think I do need the Code Behind).
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to: Karen Revisited by Sonic Youth (Track 4 from the album: Murray Street)
|
|

April 9th, 2004, 08:03 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Are you sure this is the right page? I don't see the txtHour and txtHourTenths text boxes...
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to: Karen Revisited by Sonic Youth (Track 4 from the album: Murray Street)
|
|

April 9th, 2004, 08:15 AM
|
|
Friend of Wrox
|
|
Join Date: Oct 2003
Posts: 218
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Actually, they are called txtInquiryDurationHour and txtInquiryDurationHourTenths
- - - - - - - - - - - - - - - - - - - - - - -
In God we trust, everything else we test.
|
|

April 9th, 2004, 08:44 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Right. I think I found the problem. You should set the IsValid of the ServerValidateEventArgs to False, instead of control itself. I am not sure why you can't invalidate the control directly, but I know it works when you change it to the code below. (Maybe Peter can shed some light on this):
Code:
Protected Sub CustomValidator1_ServerValidate(ByVal source As System.Object, ByVal args As System.Web.UI.WebControls.ServerValidateEventArgs) Handles CustomValidator1.ServerValidate
If Not txtHour.Text Is System.DBNull.Value And Not txtHourTenths.Text Is System.DBNull.Value Then
If IsNumeric(txtHour.Text) And IsNumeric(txtHourTenths.Text) Then
If (CInt(txtHour.Text) + CInt(txtHourTenths.Text)) = 0 Then
' CustomValidator1.IsValid = False
args.IsValid = False
End If
End If
End If
End Sub
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to: Ecstasy by P.J. Harvey (Track 14 from the album: Rid Of Me)
|
|

April 9th, 2004, 08:53 AM
|
|
Friend of Wrox
|
|
Join Date: Oct 2003
Posts: 218
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
BINGO! I had a feeling it would be a small change!
As for "I am not sure why you can't set invalidate the control directly",
well, that would make too much sense :)
I tip my virtual cap to you, sir.
-- Colonel
- - - - - - - - - - - - - - - - - - - - - - -
In God we trust, everything else we test.
|
|

April 9th, 2004, 08:55 AM
|
|
Friend of Wrox
|
|
Join Date: Oct 2003
Posts: 218
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I almost forgot --
I'm listening to "Bloodsucking Leeches" by "The Dixie Dregs" from the Album "Bring 'Em Back Alive"
- - - - - - - - - - - - - - - - - - - - - - -
In God we trust, everything else we test.
|
|

April 9th, 2004, 09:06 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Well, it may be because the Event can handle multiple controls, so setting the IsValid of the generic args object seems to make a bit sense.
But also setting source.IsValid to False (source holds a reference to your CustomValidator1 control) doesn't seem to work.
Oh well, at least it works now.....
Cheers,
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to: Echo by Incubus (Track 9 from the album: Morning View)
|
|

April 9th, 2004, 09:08 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Quote:
quote:I almost forgot --
I'm listening to "Bloodsucking Leeches" by "The Dixie Dregs" from the Album "Bring 'Em Back Alive"
|
That's the good thing about an automated solution: you can't forget it..... ;)
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to: Cinderella's big score by Sonic Youth (Track 4 from the album: Dirty boots)
|
|
 |