I have a search feature (written by my predecessor) which takes date range, id, available programs as input and displays the results in a gridview. The feature works fine most of the time (I have tested it) but for one of the users of my application it gave this error message. I am not able to reproduce this error by myself in order to fix it. Don't know what's wrong!
Can you guys help?
Exception of type 'System.Web.HttpUnhandledException' was thrown. System.FormatException: String was not recognized as a valid DateTime. at System.DateTimeParse.Parse(String s, DateTimeFormatInfo dtfi, DateTimeStyles styles)
at System.Convert.ToDateTime(String value) at APP_ViewFollowupWorkload.GetFilterString() in d:\SharedServices\APP\ViewFollowupWorkload.aspx.cs:line 1415
at APP_ViewFollowupWorkload.Page_Load(Object sender, EventArgs e) in d:\SharedServices\APP\ViewFollowupWorkload.aspx.cs:line 268
at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e)
at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e)
at System.Web.UI.Control.OnLoad(EventArgs e)
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.HandleError(Exception e)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest()
at System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) at System.Web.UI.Page.ProcessRequest(HttpContext context)
at ASP.app_viewfollowupworkload_aspx.ProcessRequest(HttpContext context) in c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\bad754dd\a11f74ff\App_Web_viewfollowupworkload.aspx.ae7ca9bd.uwyek3vs.0.cs:line 0
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
Here is the .cs file code where the error generating:
if (txtDateTo.ToString() != string.Empty)
{
if (txtDateTo.ToString().Length > 2)
strFilter = strFilter + " AND submission_date <= ''" + Convert.ToString(Convert.ToDateTime(txtDateTo.ToString()) + new TimeSpan(1, 0, 0, 0)) + "''";
}