DataRowView drvPortfolio = (DataRowView)e.Item.DataItem;
One of the columns, ExitDateTime, is a SQL Server datetime column that contains some null values. The following code does not work:DateTime exitDateTime = (DateTime)drvPortfolio["EnterPriceDateTime"];
For the rows with a null value. In that case, I get the following error: