Ok, I keep running into this problem
In my aspx I am calling a simple function.
But the problem is, that the function is either, string, integer, etc.
If there's null's in the data, the function explodes because it's set to a string or integer, etc.
How can I make the function accept both a null, and another data type so that I can
write some if then's to do different things if it is null or another data type.
Here is the code to give you an idea
UserRating needs to accept both null and decimal
any help would be greatly appreciated
In my aspx I am calling a simple function.
But the problem is, that the function is either, string, integer, etc.
If there's null's in the data, the function explodes because it's set to a string or integer, etc.
How can I make the function accept both a null, and another data type so that I can
write some if then's to do different things if it is null or another data type.
Here is the code to give you an idea
Code:
.aspx code
<%# GetRatingFormat(Container.DataItem("Rating") %>
.vb code
Function GetRatingFormat(ByVal UserRating As Decimal) As String
If IsNothing(UserRating) Or IsDBNull(UserRating) Then
Return "Not Yet Rated"
Else
Return Format(UserRating, "0.0") & "%"
End If
End Function
any help would be greatly appreciated
Comment