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_S erverValidate(B yVal source As Object, ByVal args As System.Web.UI.W ebControls.Serv erValidateEvent Args) Handles cvVillageTown.S erverValidate
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
Protected Sub cvVillageTown_S erverValidate(B yVal source As Object, ByVal args As System.Web.UI.W ebControls.Serv erValidateEvent Args) Handles cvVillageTown.S erverValidate
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