Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Index was out of range error - in web forms jump start
Message
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Title:
Index was out of range error - in web forms jump start
Miscellaneous
Thread ID:
00949796
Message ID:
00949796
Views:
59
Hi Kevin,
I'm getting the following error in the web forms example, in the Update button handler method of the OrderDetails DataGrid. It happens on the save() function. I've stepped through lots of code in the debugger, but can't figure it out. I've verified that the ItemIndex is being set correctly. Hope I didn't do something stupid.. Any ideas? TIA. Mark

Server Error in '/Order System Web CSharp' Application.
--------------------------------------------------------------------------------

Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index

Source Error:


Line 126: this.grdOrderDetail.EditItemIndex= e.Item.ItemIndex;
Line 127: DataSet dsOrderDetail= (DataSet)Session["dsOrderDetail"];
Line 128: this.Save(this.oOrderDetail, dsOrderDetail);
Line 129: this.grdOrderDetail.EditItemIndex= -1;
Line 130: this.BindControl(this.grdOrderDetail);


Source File: c:\inetpub\wwwroot\order system web csharp\orderedit.aspx.cs Line: 128

Stack Trace:


[ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index]
System.Collections.ArrayList.get_Item(Int32 index) +91
System.Web.UI.WebControls.DataGridColumnCollection.get_Item(Int32 index)
OakLeaf.MM.Main.Web.UI.WebControls.mmDataGrid.BindBack(DataSet ds, String tableName)
OakLeaf.MM.Main.Web.UI.mmWebBindingStrategyDataGrid.BindData(ImmWebBindingDataGrid mmGrid, mmBusinessObject bizObj, Boolean bindBack, mmBusinessStateChangeEventArgs e)
OakLeaf.MM.Main.Web.UI.mmWebBindingStrategyDataGrid.BindData(ImmWebBindingDataGrid mmGrid, mmBaseBusinessObject bizObj, Boolean bindBack, mmBusinessStateChangeEventArgs e)
OakLeaf.MM.Main.Web.UI.WebControls.mmDataGrid.StateChangeHandler(mmBaseBusinessObject bizObj, mmBusinessStateChangeEventArgs e)
OakLeaf.MM.Main.Business.mmBusinessObject.OnStateChange(mmBusinessState bizState, String tableName, Object primaryKeyValue, Object[] primaryKeyValues)
OakLeaf.MM.Main.Business.mmBusinessObject.CallStateChange(mmBusinessState bizState, String tableName)
OakLeaf.MM.Main.Business.mmBusinessObject.SaveDataSet(DataSet ds, String tableName, String databaseKey, IDbDataAdapter dbAdapter)
OakLeaf.MM.Main.Business.mmBusinessObject.SaveDataSet(DataSet ds, String tableName, String databaseKey)
OakLeaf.MM.Main.Business.mmBusinessObject.SaveDataSet(DataSet ds, String tableName)
OakLeaf.MM.Main.Business.mmBusinessObject.SaveDataSet(DataSet ds)
OakLeaf.MM.Main.Web.UI.mmBusinessWebPage.Save(mmBusinessObject bizObj, DataSet ds, String tableName)
OakLeaf.MM.Main.Web.UI.mmBusinessWebPage.Save(mmBusinessObject bizObj, DataSet ds)
Acme.WebOrderSystem.OrderEdit.grdOrderDetail_UpdateCommand(Object source, DataGridCommandEventArgs e) in c:\inetpub\wwwroot\order system web csharp\orderedit.aspx.cs:128
System.Web.UI.WebControls.DataGrid.OnUpdateCommand(DataGridCommandEventArgs e)
System.Web.UI.WebControls.DataGrid.OnBubbleEvent(Object source, EventArgs e)
OakLeaf.MM.Main.Web.UI.WebControls.mmDataGrid.OnBubbleEvent(Object source, EventArgs e)
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args)
System.Web.UI.WebControls.DataGridItem.OnBubbleEvent(Object source, EventArgs e)
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args)
System.Web.UI.WebControls.Button.OnCommand(CommandEventArgs e)
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
System.Web.UI.Page.ProcessRequestMain()
Next
Reply
Map
View

Click here to load this message in the networking platform