View Single Post
  #1 (permalink)  
Old June 6th, 2008, 04:54 PM
AspNetGuy AspNetGuy is offline
Authorized User
Join Date: Apr 2008
Location: , , .
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to AspNetGuy
Default DDL Custom Validator

I have created a custom validator modeling after the example in chapter 9.

The CustomValidator is in a cell with the DDL it is to validate. They are both contained in a DetailsView and the DetailsView is contained in the first step of a Wizard.

There is a JavaScript function for client side validation specified on the CustomValidator control in teh ClientValidationFunction parameter. Also there is a C# function coded and specified in the OnServerValidate parameter.

There seem to be two problems:
1) The JavaScript function is only called if I actually select an item in the DDL.

2) The ServerValidator function is only called if something is selected in the DDL.

My goal is to ensure that something is selected in the DDL.

As it is working now when the user clicks the NEXT button on the Wizard page w/o having selected anything in the DDL, the DDL is validated in the ButtonClick function with code I have there.

So how do I get the DDL validated on the client side BEFORE a post back? I am making the assumption that the ButtonClick C# function designated on the OnNextButtonClick parameter on the Wizard control is running on the server.

By the way this all works just fine if I actually select something in the DDL, but I am concerned with the occaison when the user does NOT select anything in the DDL.

Thanks in advance for all of the help.

Reply With Quote