Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

RequiredFieldValidator on a web form

Status
Not open for further replies.

runnerlk

MIS
Jul 19, 2002
41
US
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

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top