The name '12/03/2012 13.33.34' could not be found in the 'SeriesCollection'

Hi there, I hope your help.

This is my asp net code:

Chart1.Series[DateTime.Now.ToString()].YValueMembers = "Date_time";

...

<Series>
<asp:Series Name="<%= DateTime.Now.ToString() %>" ChartArea="ChartArea1">
</asp:Series>
</Series>

I have this error, can you help me?
thanks

Server Error in ‘/’ Application.


A chart element with the name ‘12/03/2012 13.33.34’ could not be found in the ‘SeriesCollection’.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.ArgumentException: A chart element with the name ‘12/03/2012 13.33.34’ could not be found in the ‘SeriesCollection’.

The problem you have is that DateTime.Now will return the current datetime struct when called. So if you call it twice you will generally get two different values depending on exactly when each call was made. Since you are trying to use that is an index for some reason or another it can’t find the index you previously created with a different DateTime.Now value.

many thanks for your reply, I fix my error.