Conversion from type 'DBNull' to type 'Integer' is not valid.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.
Exception Details: System.InvalidCastException: Conversion from type
'DBNull' to type 'Integer' is not valid.
Source Error:
Line 3122: Get
Line 3123: Try
Line 3124: Return
CType(Me(Me.tableMFT_Products.CaloriesFromFatPercColumn),Integer)
Line 3125: Catch e As Global.System.InvalidCastException
Line 3126: Throw New
Global.System.Data.StrongTypingException("The value for column
'CaloriesFromFatPerc' in table 'MFT_Products' is DBNull.", e)
So now I'm back to having to hand check every field for nulls on the
databound event, which really isn't saving me any time. My whole reason for
using the formview was to be able to use the templates to have some control
on the way the data displayed. In a gridview or other databound controls,
the framework automatically ignores null values. Is there a way to make the
formview behave similarly?
Thanks,
Matt
FormView is normally just as tolerant of null values as the other data
control types you mention. The exception is being thrown by what looks
like hand-written code to convert the field to an integer.
"Stan" <goo...@philphall.me.uk> wrote in message
news:61bfaa60-a002-4db6...@p25g2000hsf.googlegroups.com...