asp.net - datetime exception -


I'm getting an exception when I fade data text box Gridwu

  date time DT; . . {Dt = DateTime.Parse (Request form [row.FindControl ("txtPLI_MAN"). UniqueID]); // I assign it to the data base   

but here to get an exception that "string was not recognized as valid date time"

There is an exception description

  system.FormatException was rejected by the user code Message = "The string was not recognized as a valid date time." Source = "mscorlib" StackTrace: \ Inetpub \: The SystemkDateTimeParsekParse (string System.DateTime.Parse on Newattendance.Button1_Click, DateTimeFormatInfo dtfi, DateTimeStyles styles) (String s) (less object sender, EventArgs e) C the Wwwroot \ conversion \ work_space \ my_workspace.aspx.cs: on System.Web.U..WebControls.Button.OnClick (EventArgs e) System.Web.UI.WebControls.Button.RaisePostBackEvent (String eventArgument) on System.Web line 61 .UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.ReisePostBackEvent (string eventArgument) (Aiofaakbakiventhandlr source control System.Web.UI.Page.RaisePostBackEvent, string Iventagrment) system. Web. Uaikprishtkraijhpostbakivent (Nambisisht compilation Postdeta) System.Web.UI.Page.ProcessRequestMain (Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) InnerException:   

How to go wrong in the text box on the right I'm doing to get

Try using a string and co-string Nortst on Dettaim Such as:

  string s = ""; S = Request.Form [row.FindControl ("txtPLI_MAN") UniqueID.]; Datetime dt; Dt = datetime.Parse (s);   

or dt = (datetime) s;

And see what happens

With this at least you can debug on each and every step to see the content and see where you make a mistake To do this

Comments