I am trying to get null values to show on my Grid View as a blank. The only issue I am having this with is Dates and Integers (Dates show up as 1/1/0001 and integers are showing up as -1) I created a function to convert any null date into a blank space. But when I try to compile it wont. There are no errors just a few warnings. The code I am using is the following:
On the aspx page: (I truncated almost all of the Grid View code as it is very large)
<ItemTemplate>
<asp:Label ID="Label2" runat="server" Text='<%# MakeNullBlank(Bind("DateOfBirth")) %>' ></asp:Label>
</ItemTemplate>
</asp:TemplateField>
And my function in the aspx.vb codebehind file
Public Function MakeNullBlank(ByVal sDate As String) As String
If sDate Is Nothing Or sDate = "1/1/0001 12:00:00 AM" Or sDate = "12:00:00 AM" Then
MakeNullBlank = ""
Else
MakeNullBlank = sDate
End If
Return MakeNullBlank
End Function
The warnings I get are all intellisense warnings and one about SynchronizeModule()
Warning 1 'Public Sub SynchronizeModule()' is obsolete: 'This method is deprecated. Plaese use ModuleController.SynchronizeModule(ModuleId)'.
Warning 5 Errors occurred while compiling the Xml schemas in the project. Because of this, Xml intellisense is not available. C
But if I take out the call to my function in the aspx page the page compliles correctly:
<ItemTemplate>
<asp:Label ID="Label2" runat="server" Text='<%# Bind("DateOfBirth") %>' ></asp:Label>
</ItemTemplate>
</asp:TemplateField>
Am I calling the function in some incorrect way that is causing this to happen? Any help would be greatly appreciated.
Chris