»
 

Go Back   ResellerRatings Store Ratings > ResellerRatings Forums > Tech Support

Reply
 
LinkBack Thread Tools Display Modes
Old 10-23-2003, 10:01 AM   #1 (permalink)
Registered User
 
Join Date: Oct 2002
Posts: 64
gicio is on a distinguished road
Kids ASP.NET: Problems with CustomValidator...

Hi!

I have a litte problem with my CustomValidator.


What my CustomValidator should do:
The CustomValidator should check if 2 textboxes are empty..
if yes he should diplay a message.


This is my code:

Code:
<asp:customvalidator id="CustomValidator1" runat="server" ErrorMessage="Sie müssen min. 1 Telefonnummer angeben"
		Display="Static" OnServerValidate="ValidateExistanceOfPhones"></asp:customvalidator></P>

Code:
	<script runat="server">
		void ValidateExistanceOfPhones(object source, ServerValidateEventArgs args)
		{
			args.IsValid = !((m_txtTelephoneNumber.Text.Length == 0) && (m_txtMobileNumber.Text.Length == 0));
		}
	</script>


the calidator check ValidateExistanceOfPhones. but when args.IsValid = false the message isn't
shown. What is the problem??!
Make I something wrong?

2. quastion: is it possible to check the state of the 2 textboxes on the client side?
when YES how?



best regards,


gicio

gicio is offline   Reply With Quote
Old 10-26-2003, 10:50 AM   #2 (permalink)
Registered User
 
Join Date: Sep 2002
Posts: 265
Creosote is on a distinguished road
I would use two RequiredField Validators instead of a custom validator. If either one is left blank, it will display the message(s).
Creosote is offline   Reply With Quote
Reply




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Most Active Discussions

Recent Discussions

All times are GMT -6. The time now is 01:16 AM.