String was not recognized as a valid DateTime.

Posted by Madhuri123 under ASP.NET on 7/20/2011 | Points: 10 | Views : 2986 | Status : [Member] | Replies : 1
Hi,

I used ajax control to display time in textbox and i had wrritten the code as
Products.MfgDate =DateTime.Parse( TxtManufractureDate.Text.Trim());

but i am getting the error as "String was not recognized as a valid DateTime.".




Responses

Posted by: SheoNarayan on: 7/20/2011 [Administrator] HonoraryPlatinum | Points: 25

Up
0
Down
Try to write the datetime you are getting from the Ajax controller using Response.Write and see if it is giving yor datetime in correct format. If not you will have to manually manipulate the value to the culture accepted by your server.

Read this post http://www.dotnetfunda.com/codes/code348-how-to-convert-us-date-time-to-uk-datetime-and-vice-versa-.aspx that should give you some clue.

Thanks

Regards,
Sheo Narayan
http://www.dotnetfunda.com

Madhuri123, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response