异常详细信息: System.ArgumentOutOfRangeException: 指定的参数已超出有效值的范围。
参数名: index源错误:
行 689: Page.RegisterStartupScript("a", "<script>alert('" + GridView1.Rows[e.RowIndex].Cells[0].ToString() + "')</script>");
行 690:
行 691: string zbid = ((TextBox)GridView1.Rows[e.RowIndex].Cells[0].Controls[0]).Text.ToString().Trim();
行 692: string fz = ((TextBox)GridView1.Rows[e.RowIndex].Cells[8].Controls[0]).Text.ToString().Trim();
行 693: string shf = ((TextBox)GridView1.Rows[e.RowIndex].Cells[9].Controls[0]).Text.ToString().Trim();
源文件: e:\Jack\kygl0527\WebSite5\Admin\WorkCheck.aspx.cs 行: 691
第689行没有错。第691行出错了,那说明是Controls[0]里面的0越界了?这个怎么可能越界呢?高手指点下!
参数名: index源错误:
行 689: Page.RegisterStartupScript("a", "<script>alert('" + GridView1.Rows[e.RowIndex].Cells[0].ToString() + "')</script>");
行 690:
行 691: string zbid = ((TextBox)GridView1.Rows[e.RowIndex].Cells[0].Controls[0]).Text.ToString().Trim();
行 692: string fz = ((TextBox)GridView1.Rows[e.RowIndex].Cells[8].Controls[0]).Text.ToString().Trim();
行 693: string shf = ((TextBox)GridView1.Rows[e.RowIndex].Cells[9].Controls[0]).Text.ToString().Trim();
源文件: e:\Jack\kygl0527\WebSite5\Admin\WorkCheck.aspx.cs 行: 691
第689行没有错。第691行出错了,那说明是Controls[0]里面的0越界了?这个怎么可能越界呢?高手指点下!
解决方案 »
- 风讯NET源码版如何用?
- 技术贴!!在类中得到,调用本类的页面实体。。。在线等。
- 修改新闻成功后,跳转到当前修改页面,怎么做啊。
- SqlDataSource控件
- Unterminated string constant 错误是什么错误啊 急!
- 请问从网页发短信息到手机或者小灵通,应该怎样做才能实现?
- 关于不能响应DataGrid1_ItemCommand的问题
- 为什么他提示说"pwd"不在表admin中呢?明明在啊?哪位大虾来看看?
- 如何在客户端删除TreeView的指点节点(在线等待)
- 奇怪,我的TextBox的TextChanged事件不响应了?大家帮忙看看。
- 数据集的查询问题 在线等
- 【提问】网站中flv视频无法播放?
用Controls[0]肯定报错
<asp:GridView ID="GridView1" runat="server" Width="99%" AutoGenerateColumns="False"
DataKeyNames="ZPID" OnRowDeleting="GridView1_RowDeleting" CellPadding="4" ForeColor="#333333"
GridLines="None" OnRowEditing="GridView1_RowEditing" OnSelectedIndexChanging="GridView1_SelectedIndexChanging"
AllowSorting="True" AllowPaging="True" PageSize="8" OnDataBound="GridView1_DataBound"
OnRowDataBound="GridView1_RowDataBound" OnPageIndexChanging="GridView1_PageIndexChanging"
OnSorting="GridView1_Sorting" OnRowUpdating="GridView1_RowUpdating" OnRowCancelingEdit="GridView1_RowCancelingEdit">
<Columns>
<asp:BoundField DataField="ZPID" HeaderText="论文/作品编号" ReadOnly="True" SortExpression="ZPID">
</asp:BoundField>
<asp:BoundField DataField="CGLB" HeaderText="成果类别" SortExpression="CGLB" ReadOnly="True"></asp:BoundField>
<asp:BoundField DataField="CGMC" HeaderText="成果名称" SortExpression="CGMC" ReadOnly="True"></asp:BoundField>
<asp:BoundField DataField="JB" HeaderText="级别" SortExpression="JB" ReadOnly="True"></asp:BoundField>
<asp:BoundField DataField="ZBID" HeaderText="子表编号" ReadOnly="True" SortExpression="ZBID" ></asp:BoundField>
<asp:BoundField DataField="YGH" HeaderText="员工号" ReadOnly="True" SortExpression="YGH">
</asp:BoundField>
<asp:BoundField DataField="XM" HeaderText="姓名" ReadOnly="True" SortExpression="XM">
</asp:BoundField>
<asp:BoundField DataField="BM" HeaderText="部门" ReadOnly="True" SortExpression="BM"></asp:BoundField>
<asp:BoundField DataField="FZ" HeaderText="分值" SortExpression="FZ">
</asp:BoundField>
<asp:BoundField DataField="SHF" HeaderText="审核否" SortExpression="SHF"></asp:BoundField>
<asp:ButtonField CommandName="DelName" Text="删除" Visible="False" />
<asp:ButtonField CommandName="SelName" Text="详细" Visible="False" />
<asp:CommandField ShowEditButton="True" />
<asp:TemplateField ShowHeader="False">
<ItemTemplate>
<asp:ImageButton ID="img3" runat="server" CausesValidation="False" CommandName="Select"
ImageUrl="~/Teacher/Images/SysSkin/look.jpg" />
</ItemTemplate>
<ItemStyle HorizontalAlign="Center" Width="30px" />
</asp:TemplateField>
<asp:TemplateField ShowHeader="False">
<ItemTemplate>
<asp:ImageButton ID="img2" runat="server" CausesValidation="false" CommandName="Delete"
OnClientClick='return confirm("确认要删除吗?")' ImageUrl="~/Teacher/Images/SysSkin/del.gif" />
</ItemTemplate>
<ItemStyle HorizontalAlign="Center" Width="30px" />
</asp:TemplateField>
</Columns>
<FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
<RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
<EditRowStyle BackColor="#999999" />
<SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
<PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
<HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
<AlternatingRowStyle BackColor="White" ForeColor="#284775" />
</asp:GridView>
<asp:Button ID="Button6" runat="server" OnClick="Button6_Click" Text="导出数据" /></asp:View>
用不着Cells[0]。可以参考我在这个帖子的回复:
http://topic.csdn.net/u/20081214/19/56B6B999-BD7C-48E3-9B2F-61A3AB0CCF57.html