参数超出有效范围
异常信息:
指定的参数已超出有效值的范围。
参数名: index
GridView的删除事件。
protected void GridView_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
BLL_FlightTb Flight = new BLL_FlightTb();
string flightid=((TextBox)(GridView.Rows[e.RowIndex].Cells[0].Controls[0])).Text.ToString().Trim();
异常信息:
指定的参数已超出有效值的范围。
参数名: index
Flight.Flight_Delete(flightid);
this.bind();
}
前台GridView的代码是这样的:
<asp:GridView ID="GridView" runat="server" CellPadding="2"
ForeColor="#333333" AutoGenerateColumns="False" CellSpacing="2"
onrowcancelingedit="GridView_RowCancelingEdit"
onrowdeleting="GridView_RowDeleting" onrowediting="GridView_RowEditing"
onrowupdating="GridView_RowUpdating">
<FooterStyle BackColor="#990000" Font-Bold="true" ForeColor="White" />
<Columns>
<asp:BoundField DataField="FlightID" HeaderText="航班号" ReadOnly="true"/>
<asp:BoundField DataField="FlightTime" HeaderText="航班时间" />
<asp:BoundField DataField="FlightStart" HeaderText="起始地点"/>
<asp:BoundField DataField="FlightEnd" HeaderText="到达地点"/>
<asp:BoundField DataField="Launch" HeaderText="起飞时间"/>
<asp:BoundField DataField="Land" HeaderText="到达时间"/>
<asp:BoundField DataField="MidStation" HeaderText="中间站" />
<asp:BoundField DataField="Capacity" HeaderText="乘客量" />
<asp:BoundField DataField="Remain" HeaderText="空票数" />
<asp:BoundField DataField="Price" HeaderText="票价" />
<asp:CommandField HeaderText="选择" ShowSelectButton="true" />
<asp:CommandField HeaderText="编辑" ShowEditButton="true" />
<asp:CommandField HeaderText="删除" ShowDeleteButton="true" />
</Columns>
<RowStyle ForeColor="#000066" />
<SelectedRowStyle BackColor="#669999" Font-Bold="true" ForeColor="White"/>
<PagerStyle BackColor="White" ForeColor="#000066" HorizontalAlign="Left"/>
<HeaderStyle BackColor="#006699" Font-Bold="True" ForeColor="White" />
</asp:GridView>