1

I have a bar chart which has different series .Each series has to point different page. I am giving URL.I got this error.

Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index 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.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index

Source Error:

Line 133:series1.Points[i].MapAreaAttributes = "Target=\"_blank\""; Line 134:series1.Points[0].Url = "db_PMUKPI_ByRM.aspx?Month=" + iMonth + "&Year=" + iYear; Line 135:series1.Points[1].Url = "db_PmuKpi_AllMonths.aspx?Month=" + iMonth + "&Year=" + iYear; Line 136:series1.Points[2].Url = "db_PmuKpi_AllMonths.aspx?Month=" + iMonth + "&Year=" + iYear; Line 137:series1.Points[3].Url = "db_PmuKpi_Overall_DateRange.aspx?Month=" + iMonth + "&Year=" + iYear;

KV Prajapati
  • 93,659
  • 19
  • 148
  • 186
Chow.Net
  • 593
  • 6
  • 13
  • 25

2 Answers2

2

Without seeing the actual code, I'm going to assume you are using some sort of a loop and line 133 is inside the loop. It appears you are trying to access your object series1.Points[i], i being the index. Remember indexes generally start at 0 and end at number of objects - 1. So if you are using a for..loop, do it this way:

int numItems = series1.Points.Count();
for (int i = 0; i < numItems; i++)
{
series1.Points[i].MapAreaAttributes = "Target=\"_blank\"";
}
Moses Machua
  • 11,245
  • 3
  • 36
  • 50
0

GridView missing Datakeyname="id"