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

Custom Validation Help

P: 1
Hi, I want to validate 2 textboxes on a web form to make sure neither of them are blank, i.e. both can be filled or either but neither can be empty. I have created a custom validator and entered the below code behind it:

Protected Sub cvVillageTown_ServerValidate(ByVal source As Object, ByVal args As System.Web.UI.WebControls.ServerValidateEventArgs) Handles cvVillageTown.ServerValidate
If tbVillage.Text = "" And tbTown.Text = "" Then
args.IsValid = False
Else
args.IsValid = True
End If
End Sub

However, I am working with components as I'm developing forms which a similar and the 'submit' button on which validation needs to be activated is on the master page. Is there a way of activating the error once the submit button is pressed? The other validators work e.g. required field as they can just be used without coding behind. Thanks
Jan 25 '08 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.