T
TJS
I need to add validation to drodownlist control but it sends back an error
message that says:
"System.Web.UI.WebControls.DropDownList' does not allow child controls"
the code is :
If e.ItemType = ItemType.FieldItem And e.ColumnName = "IDEvent" Then
Dim ctlEvent As DropDownList = CType(e.Control, DropDownList)
Dim compVal AS CompareValidator = New CompareValidator()
compVal.ErrorMessage = " Please, select something from the list"
compVal.ValueToCompare = ""
compVal.Type = ValidationDataType.String
compVal.Operator = ValidationCompareOperator.NotEqual
ctlEvent.Controls.Add(compVal) '<== error here
End If
How canI add validation to the droplist ??
message that says:
"System.Web.UI.WebControls.DropDownList' does not allow child controls"
the code is :
If e.ItemType = ItemType.FieldItem And e.ColumnName = "IDEvent" Then
Dim ctlEvent As DropDownList = CType(e.Control, DropDownList)
Dim compVal AS CompareValidator = New CompareValidator()
compVal.ErrorMessage = " Please, select something from the list"
compVal.ValueToCompare = ""
compVal.Type = ValidationDataType.String
compVal.Operator = ValidationCompareOperator.NotEqual
ctlEvent.Controls.Add(compVal) '<== error here
End If
How canI add validation to the droplist ??