hi
I have a detailsview with a template field in, e.g:
What I would like to do is if the date is less than "01/01/2000" then hide the label.
I have tried to achieve this through code behind by finding the control, e.g:
but I receive a "Object reference not set to an instance of an object" error.
any advice on the best way to achieve this?
thanks.
I have a detailsview with a template field in, e.g:
VB.NET:
<asp:TemplateField HeaderText="Starting Date">
<ItemTemplate>
<asp:Label ID="lblStartingDate" runat="server"
Text='<%# Bind("[Starting Date]", "{0:dd/MM/yyyy}") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
What I would like to do is if the date is less than "01/01/2000" then hide the label.
I have tried to achieve this through code behind by finding the control, e.g:
VB.NET:
lblstartingdate = DirectCast(Me.DetailsView2.FindControl("lblStartingDate"), Label)
If lblstartingdate.Text < "01/01/2000" Then
lblstartingdate.Visible = False
End if
but I receive a "Object reference not set to an instance of an object" error.
any advice on the best way to achieve this?
thanks.