I have getting mention error..
Server Error in '/' Application.
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. Source Error:
Line 221: <asp:TemplateField HeaderText="Closed Hours">
Line 222: <ItemTemplate>
Line 223: <asp:Label ID="Label6" runat="server" Text='<%#(Convert.ToDateTime(Eval("COMP_LODGE_DATE")).Subtract(Convert.ToDateTime(Eval("CLOSING_DATE")))).TotalDays.ToString() %>'></asp:Label>
Line 224: </ItemTemplate>
Line 225: <ItemStyle Width="500px"></ItemStyle>
Source File: c:\inetpub\wwwroot\OCMS\OCMS\comp_rd_only.aspx Line: 223
Stack Trace:
[InvalidCastException: Object cannot be cast from DBNull to other types.]
System.DBNull.System.IConvertible.ToDateTime(IFormatProvider provider) +55
System.Convert.ToDateTime(Object value) +33
ASP.comp_rd_only_aspx.__DataBinding__control62(Object sender, EventArgs e) in c:\inetpub\wwwroot\OCMS\OCMS\comp_rd_only.aspx:223
System.Web.UI.Control.OnDataBinding(EventArgs e) +86
System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) +154
System.Web.UI.Control.DataBind() +17
System.Web.UI.Control.DataBindChildren() +187
System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) +164
System.Web.UI.Control.DataBind() +17
System.Web.UI.Control.DataBindChildren() +187
System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) +164
System.Web.UI.Control.DataBind() +17
System.Web.UI.WebControls.GridView.CreateRow(Int32 rowIndex, Int32 dataSourceIndex, DataControlRowType rowType, DataControlRowState rowState, Boolean dataBind, Object dataItem, DataControlField[] fields, TableRowCollection rows, PagedDataSource pagedDataSource) +170
System.Web.UI.WebControls.GridView.CreateChildControls(IEnumerable dataSource, Boolean dataBinding) +3839
System.Web.UI.WebControls.CompositeDataBoundControl.PerformDataBinding(IEnumerable data) +67
System.Web.UI.WebControls.GridView.PerformDataBinding(IEnumerable data) +15
System.Web.UI.WebControls.DataBoundControl.OnDataSourceViewSelectCallback(IEnumerable data) +133
System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +34
System.Web.UI.WebControls.DataBoundControl.PerformSelect() +151
System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +76
System.Web.UI.WebControls.GridView.DataBind() +10
OCMS.comp_rd_only.refreshdata() in c:\inetpub\wwwroot\OCMS\OCMS\comp_rd_only.aspx.cs:99
OCMS.comp_rd_only.Page_Load(Object sender, EventArgs e) in c:\inetpub\wwwroot\OCMS\OCMS\comp_rd_only.aspx.cs:30
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +52
System.Web.UI.Control.OnLoad(EventArgs e) +97
System.Web.UI.Control.LoadRecursive() +61
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +693
|
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.8.9206.0