How can I replace the text of a label control contained in a formview?
I've tried to use the code below:
Protected Sub FormViewNews_DataBound(sender As Object, e As System.EventArgs) Handles FormViewNews.DataBound
Dim pagerRow As FormViewRow = FormViewNews.BottomPagerRow
Dim Active As Label = CType(pagerRow.Cells(2).FindControl("OFMLabel"), Label)
If Active = "False" Then
Active = "Public"
Else
Active = "Private"
End If
End Sub
But then I've got this error message: "Object reference not set to an instance of an object.".
i.e. I have a label named 'OFMLabel', and its valued 'TRUE'. Then, if TRUE, I want to change its text become 'PRIVATE', and if FALSE, become 'PUBLIC'.
Anyone can help me, please?
Thanks.