Dropdownlist custom validator

SuryaPrakasaRao

New member
Joined
Jul 11, 2006
Messages
2
Programming Experience
Beginner
in my application i put custom validator to validate selected text. drop down list conatins some items to select, I put first item as "Select Here" if we can select any item in the dropdownlist, if no item is selected i.e, "Select Here" is current item then it validator shows U must Select item... This is ok when i press "ADD" button again it show errmessage even if it is not "Select Here" please send code and procedure for that. thanking you
 
Last edited:
SuryaPrakasaRao said:
in my application i put custom validator to validate selected text. drop down list conatins some items to select, I put first item as "Select Here" if we can select any item in the dropdownlist, if no item is selected i.e, "Select Here" is current item then it validator shows U must Select item... This is ok when i press "ADD" button again it show errmessage even if it is not "Select Here" please send code and procedure for that. thanking you

/* Cv is Custom Validator name
Custom Validator name : cv
ClientValidation Function: Validation
ControltoValidate : ddl (Dropdownlistname, and I set ddl autopostback true)
Error Message : U must Select Item
*/
Public Function Validation() As String
If ddl.SelectedItem.Text = "Select Here" Then
cv.IsValid = False
Else
cv.IsValid = True
End If
End Function

Private Sub cv_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles cv.PreRender
Validation()
End Sub

 
Back
Top