I have (3) RequiredFieldValidator controls on a web form
1 vaildating a name in a text field(txtName)rfvName
1 vaildating a e-mail address in a text field(txtEmail)rfvEmail
1 validating a country selection in a DropDownList(ddlCountry)rfvCountry initial value = <Select a country>
All RequiredFieldValidator controls are set as display property = dynamic.
All Controls to validate are set to the proper control.
rfvName and rfvEmail work fine.
rfvCountry does not throw an error. and if I fill in vaid name and e-mail and leave ddlCountry set to <Select a country> it is appended to the other 2 fields as a vaild country.
here is the code behind in the btnSubmit
Private Sub btnSubmit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSubmit.Click
If Page.IsValid Then
Dim sbText As StringBuilder = New StringBuilder()
sbText.Append("You entered <br>")
sbText.Append(txtName.Text & "<br>")
sbText.Append(txtEmail.Text & "<br>")
sbText.Append(ddlCountry.SelectedItem.Text & "<br>")
lblMessage.Text = sbText.ToString()
Any help would be greatly appreciated.
Lou
1 vaildating a name in a text field(txtName)rfvName
1 vaildating a e-mail address in a text field(txtEmail)rfvEmail
1 validating a country selection in a DropDownList(ddlCountry)rfvCountry initial value = <Select a country>
All RequiredFieldValidator controls are set as display property = dynamic.
All Controls to validate are set to the proper control.
rfvName and rfvEmail work fine.
rfvCountry does not throw an error. and if I fill in vaid name and e-mail and leave ddlCountry set to <Select a country> it is appended to the other 2 fields as a vaild country.
here is the code behind in the btnSubmit
Private Sub btnSubmit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSubmit.Click
If Page.IsValid Then
Dim sbText As StringBuilder = New StringBuilder()
sbText.Append("You entered <br>")
sbText.Append(txtName.Text & "<br>")
sbText.Append(txtEmail.Text & "<br>")
sbText.Append(ddlCountry.SelectedItem.Text & "<br>")
lblMessage.Text = sbText.ToString()
Any help would be greatly appreciated.
Lou