mcallaghan
IS-IT--Management
I have a grid where I am doing a grand total it all works well but if the value can be null. When it is null it blows up. Does anyone know a work around.
<script runat="server">
Dim TotalUnitPrice As Decimal = 0.0
Function GetUnitPrice(ByVal Price As Decimal) As Decimal
If (GetUnitPrice Is Nothing) Then
Else
TotalUnitPrice += Price
Return Price
End If
End Function
Function GetTotal() As Decimal
Return TotalUnitPrice
End Function
</script>
This is the code in the gridview
<%#GetUnitPrice(Decimal.Parse(Eval("PO_Amt").ToString())).ToString("N2")%> </ItemTemplate>
Thanks
<script runat="server">
Dim TotalUnitPrice As Decimal = 0.0
Function GetUnitPrice(ByVal Price As Decimal) As Decimal
If (GetUnitPrice Is Nothing) Then
Else
TotalUnitPrice += Price
Return Price
End If
End Function
Function GetTotal() As Decimal
Return TotalUnitPrice
End Function
</script>
This is the code in the gridview
<%#GetUnitPrice(Decimal.Parse(Eval("PO_Amt").ToString())).ToString("N2")%> </ItemTemplate>
Thanks