marți, 16 septembrie 2014

ASP.NET in VS 2013

For a GridView with designer-generated columns for a custom formating in a DateTime field runtime error occurred:

[FormatException: String was not recognized as a valid DateTime.]
   System.DateTime.Parse(String s, IFormatProvider provider) +14137490
   System.Convert.ToDateTime(String value, IFormatProvider provider) +14
   System.Convert.ChangeType(Object value, TypeCode typeCode, IFormatProvider provider) +793
   System.Web.UI.WebControls.Parameter.GetValue(Object value, String defaultValue, TypeCode type, Boolean convertEmptyStringToNull, Boolean ignoreNullableTypeChanges) +236
   System.Web.UI.WebControls.Parameter.GetValue(Object value, Boolean ignoreNullableTypeChanges) +127
   System.Web.UI.WebControls.SqlDataSourceView.AddParameters(DbCommand command, ParameterCollection reference, IDictionary parameters, IDictionary exclusionList, String oldValuesParameterFormatString) +800
   System.Web.UI.WebControls.SqlDataSourceView.ExecuteUpdate(IDictionary keys, IDictionary values, IDictionary oldValues) +336
   System.Web.UI.DataSourceView.Update(IDictionary keys, IDictionary values, IDictionary oldValues, DataSourceViewOperationCallback callback) +3434273
   System.Web.UI.WebControls.GridView.HandleUpdate(GridViewRow row, Int32 rowIndex, Boolean causesValidation) +1345
   System.Web.UI.WebControls.GridView.HandleEvent(EventArgs e, Boolean causesValidation, String validationGroup) +762
   System.Web.UI.WebControls.GridViewRow.OnBubbleEvent(Object source, EventArgs e) +164
   System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +84
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3804

Error could not be traced into code and it occured when selecting in edit mode a date with day more than 12 (confusion between format dd-MM-yyyy and MM-dd-yyyy generated this)




removing type definition for the involved field resolved the problem