I receive the error message below, I think because the database field in question is null (I realize I probably should not allow null values, but I can't even display the page to allow the user to enter a value---and I would prefer not to enter a default value in SQL).
How do I avoid this error message? If the column is null (and it is supposed to be an integer), do I need to change the value to something like "0" in the code behind---or is there any easier way to do this right in aspx page (see source of error message below)? Either way, I'm not sure how to do either (I can't get any such lines of code to work here). Thank you.
Object cannot be cast from DBNull to other types. 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: Object cannot be cast from DBNull to other types.