2012-12-06 36 views
0

我有一个条形图,它有不同的系列。每个系列都有不同的页面。 我给URL.I有这个错误。指数超出范围。必须是非负数且小于集合的大小。参数名称:索引

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;

+4

什么不清楚关于错误信息? – McGarnagle

回答

1

没有看到实际的代码,我打算假设你正在使用某种循环,并且行133在循环中。看来你正试图访问你的对象series1.Points [我],我是索引。记住指标一般从0开始,在对象的数字结尾 - 1,所以,如果你使用的是for..loop,做这种方式:

int numItems = series1.Points.Count(); 
for (int i = 0; i < numItems; i++) 
{ 
series1.Points[i].MapAreaAttributes = "Target=\"_blank\""; 
} 
0

GridView的缺失Datakeyname =“ID”

相关问题