SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Evangelist Miguel61's Avatar
    Join Date
    Mar 2008
    Posts
    402
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)

    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:
    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'.

  2. #2
    SitePoint Author silver trophybronze trophy
    wwb_99's Avatar
    Join Date
    May 2003
    Location
    Washington, DC
    Posts
    10,633
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    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.

  3. #3
    SitePoint Evangelist Miguel61's Avatar
    Join Date
    Mar 2008
    Posts
    402
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    many thanks for your reply, I fix my error.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •