| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1952 人关注过本帖
标题:[求助]指定的参数已超出有效值的范围。参数名: index
只看楼主 加入收藏
yongjian27
Rank: 1
等 级:新手上路
帖 子:63
专家分:0
注 册:2006-4-5
收藏
 问题点数:0 回复次数:2 
[求助]指定的参数已超出有效值的范围。参数名: index

请大家帮忙看看是怎么回事?
指定的参数已超出有效值的范围。参数名: index
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。

异常详细信息: System.ArgumentOutOfRangeException: 指定的参数已超出有效值的范围。参数名: index

源错误:


行 124: if(di.ItemType==ListItemType.Item||di.ItemType==ListItemType.AlternatingItem)
行 125: {
行 126: ((LinkButton)di.Cells[2].Controls[0]).Attributes.Add("onclick","return confirm('确认删除此项吗?');");
行 127: }
行 128: }

源文件: c:\inetpub\wwwroot\test\webform1.aspx.cs 行: 126

堆栈跟踪:


[ArgumentOutOfRangeException: 指定的参数已超出有效值的范围。
参数名: index]
System.Web.UI.ControlCollection.get_Item(Int32 index)
test.WebForm1.DataGrid1_ItemCreated(Object sender, DataGridItemEventArgs e) in c:\inetpub\wwwroot\test\webform1.aspx.cs:126
System.Web.UI.WebControls.DataGrid.OnItemCreated(DataGridItemEventArgs e)
System.Web.UI.WebControls.DataGrid.CreateItem(Int32 itemIndex, Int32 dataSourceIndex, ListItemType itemType, Boolean dataBind, Object dataItem, DataGridColumn[] columns, TableRowCollection rows, PagedDataSource pagedDataSource)
System.Web.UI.WebControls.DataGrid.CreateControlHierarchy(Boolean useDataSource)
System.Web.UI.WebControls.BaseDataList.OnDataBinding(EventArgs e)
System.Web.UI.WebControls.BaseDataList.DataBind()
test.WebForm1.BData() in c:\inetpub\wwwroot\test\webform1.aspx.cs:80
test.WebForm1.Page_Load(Object sender, EventArgs e) in c:\inetpub\wwwroot\test\webform1.aspx.cs:35
System.Web.UI.Control.OnLoad(EventArgs e)
System.Web.UI.Control.LoadRecursive()
System.Web.UI.Page.ProcessRequestMain()


搜索更多相关主题的帖子: 有效值 参数 index 范围 
2006-11-03 10:24
小天狼星
Rank: 3Rank: 3
等 级:新手上路
威 望:6
帖 子:483
专家分:0
注 册:2006-11-1
收藏
得分:0 
di.Cells[2].Controls[0]
应该是Cells[2]或者Controls[0]超出范围了

[face=仿宋_GB2312]一生那么长,长不过时间定义下的永远;一生那么短,短不过人海中一次又一次匆忙的擦肩。[/face]
2006-11-03 10:49
yongjian27
Rank: 1
等 级:新手上路
帖 子:63
专家分:0
注 册:2006-4-5
收藏
得分:0 
我的行和列的数目挺多呀 我已经把Cell和Control里面的数改的很小了

2006-11-03 10:55
快速回复:[求助]指定的参数已超出有效值的范围。参数名: index
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.011571 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved