2012-12-06 37 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」

相關問題