473,387 Members | 1,517 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

String was not recognized as a valid DateTime

I moved some projects to another server and using the code below i get
the error:-

"String was not recognized as a valid DateTime"

<asp:Label runat="server" width="40%" text='
<%#
DateTime.Parse(DataBinder.Eval(Container,"DataItem .dt").ToString()).ToSh
ortDateString()%>' id="Label6">
*** Sent via Developersdex http://www.developersdex.com ***
Nov 19 '05 #1
3 30616
Well folks...
I added:-
culture="en-US"
to the globalization in Web.Config and did the trick

<globalization
requestEncoding="utf-8"
responseEncoding="utf-8"
culture="en-US"
/>

*** Sent via Developersdex http://www.developersdex.com ***
Nov 19 '05 #2
Hi Patrick,

If you just use DataBinder.Eval(Container,"DataItem.dt").ToString( ) is
anything displayed?

If it is, I would be checking that the date format matches your Regional
Settings (System Account). If you are using SQL I’d also be checking that
the collation of the new server/database is the same as your old one.

Brad.
"Patrick Olurotimi Ige" wrote:
I moved some projects to another server and using the code below i get
the error:-

"String was not recognized as a valid DateTime"

<asp:Label runat="server" width="40%" text='
<%#
DateTime.Parse(DataBinder.Eval(Container,"DataItem .dt").ToString()).ToSh
ortDateString()%>' id="Label6">
*** Sent via Developersdex http://www.developersdex.com ***

Nov 19 '05 #3
> <asp:Label runat="server" width="40%" text='
<%#
DateTime.Parse(DataBinder.Eval(Container,"DataItem .dt").ToString()).To
Sh
ortDateString()%>' id="Label6">


Why don't you just do this instead:

<%# ((DateTime)DataBinder.Eval(Container.DataItem, "dt")).ToShortDateString()
%>

-Brock
DevelopMentor
http://staff.develop.com/ballen


Nov 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Sterling Ledet | last post by:
I am trying to create a web service that takes a string from my web server in the following format: Mon, 6 Oct 2003 18:39:47 UTC and put's in a datetime so it can then be reformatted in C# as...
1
by: adolf garlic | last post by:
I'm having a problem with dates. (No not the sort that you have at christmas) I have a webform with a text box and a calendar control. You can either - enter a date manually (we are talking uk...
0
by: RSH | last post by:
I am having a bit of trouble filling a datatable with a query. I'm getting the error message: System.FormatException: String was not recognized as a valid DateTime. at...
6
by: Rookie Card | last post by:
I know this is a very common issue but cannot find a thread that resolves the issue. I need to re-format my dates to "MMM d, yyyy". The problem I have is I have an MSSQL database that allows...
1
by: database | last post by:
I AM FACING A PROBLEM WHEN I ACCESS ONE OF THE PAGES. IT USED TO WORK BEFORE BUT AFTER RESTARTING THE APPLICATION SEVER IT GIVES THE FOLLOWING ERROR. - Server Error ...
1
by: Scott Holman | last post by:
I'm connecting to a java web service that defines the following complex type in the wsdl <xs:complexType name="employee"> <xs:sequence> <xs:element minOccurs="0" name="firstName"...
10
by: mercea | last post by:
hi all, i'm trying to insert the time/date a button was clicked on a gridview and it generates an error:the string was not recognized as a valid DateTime.There is an unknown word starting at index 0...
0
by: Andres Bohren | last post by:
Hi i have a GridView and have Problems to put the values into the right Datatypes. Protected Sub GridView1_RowUpdating(ByVal sender As Object, ByVal e As...
4
by: dhanashivam | last post by:
hi, in my web application i am getting date values from sql server database and store in the datatable. it works fine when i use the US culture. But when i change the culture to british i am...
3
by: lucindaa | last post by:
Hi, i have a string variable having date as following format "05-01-2010" when convert this date into DateTime Format i got the following error 'String was not recognized as a valid DateTime'...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.