e.Row.Cells[0].Visible = false;
,使一列不可見。它的工作原理,但是當我嘗試添加另一個像這樣:
e.Row.Cells[0].Visible = false;
e.Row.Cells[1].Visible = false; //i tried listing all and still got the out of range error
我得到Specified argument was out of the range of valid values. Parameter name: index
我使用在GridView的RowDataBound
事件的命令,從0開始在GridView有12列
您是否設置了斷點檢查您在運行時GridView控件綁定到數據?另外,你的gridview設置爲autogeneratecolumns = true? – nycdan