我有RowDataBound事件,我想改變這樣的列名:指數超出範圍。必須爲非負且小於集合的大小
Protected Sub gvKeyValueOfstringstring_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles gvKeyValueOfstringstring.RowDataBound
If e.Row.RowType = DataControlRowType.Header Then
gvKeyValueOfstringstring.Columns(0).HeaderText = "Match"
gvKeyValueOfstringstring.Columns(1).HeaderText = "Replace"
End If
End Sub
,但我得到錯誤:
索引超出範圍。必須是非負數且小於集合的大小。 參數名稱:索引
檢查您的gridview'gvKeyValueOfstringstring'有多少列? – Rahul
一個簡單的調試可以給你答案。 – Aristos