I have a datalist that contains some textboxes in each item/alternatingitem. The users enters some data in the fields and clicks a "Save" button. In the code behind, I loop through the datalist items and validate the data that has been entered. If there is invalid data, I want to display a label that is located in the footer. How do I find that label and set visible = true? Here is what I have that does not work:
Thanks in advance...
mwa
<><
Code:
For Each i As DataListItem In DataList1.Items
If i.ItemType = ListItemType.AlternatingItem Or i.ItemType = ListItemType.Item Then
Dim fnd As TextBox = i.FindControl("txtItemFnd")
Dim fnct As TextBox = i.FindControl("txtItemFnct")
Dim obj As TextBox = i.FindControl("txtItemObj")
If SQLData.ValidateAccount(fnd.Text, fnct.Text, obj.Text) Then
Save(Request.QueryString("id"), fnd.Text, fnct.Text, obj.Text, Session("myUserId"))
else
'Find the Invalid label and make it visible (not working)
For Each x As DataListItem In DataList1.Items
If x.ItemType = ListItemType.Footer Then
Dim lbl As Label = x.FindControl("InvalidMessage")
lbl.Visible = True
End If
Next
end if
Next
Thanks in advance...
mwa
<><