C
camelean
I've been trying to correct this error for approx 2 days and am having
no luck.
In gridview.rowdatabound
Dim _dataKeyNames As String() = {"OFFICESUPPLY_ORDER_ID",
"STATUS_ID"}
gridview.DataKeyNames = _dataKeyNames
If e.Row.RowType = DataControlRowType.DataRow Then
gridview.DataKeys(e.Row.RowIndex)(1).ToString
End If
The app craps out at gridview.DataKeys(e.Row.RowIndex)(1).ToString on
row 0. the datakeynames are populated, there is a length of 2. I
just really am stuck.
Help is greatly appreciated.
Jason
Exception Details
System.ArgumentOutOfRangeException was caught
Message="Index was out of range. Must be non-negative and less than
the size of the collection.
Parameter name: index"
ParamName="index"
Source="mscorlib"
StackTrace:
at System.Collections.ArrayList.get_Item(Int32 index)
at System.Web.UI.WebControls.DataKeyArray.get_Item(Int32 index)
at cfoots_order_status.gridview_RowDataBound(Object sender,
GridViewRowEventArgs e) in
at
System.Web.UI.WebControls.GridView.OnRowDataBound(GridViewRowEventArgs
e)
at System.Web.UI.WebControls.GridView.CreateRow(Int32 rowIndex,
Int32 dataSourceIndex, DataControlRowType rowType, DataControlRowState
rowState, Boolean dataBind, Object dataItem, DataControlField[]
fields, TableRowCollection rows, PagedDataSource pagedDataSource)
at
System.Web.UI.WebControls.GridView.CreateChildControls(IEnumerable
dataSource, Boolean dataBinding)
at
System.Web.UI.WebControls.CompositeDataBoundControl.PerformDataBinding(IEnumerable
data)
at
System.Web.UI.WebControls.GridView.PerformDataBinding(IEnumerable
data)
at
System.Web.UI.WebControls.DataBoundControl.OnDataSourceViewSelectCallback(IEnumerable
data)
at
System.Web.UI.DataSourceView.Select(DataSourceSelectArguments
arguments, DataSourceViewSelectCallback callback)
at System.Web.UI.WebControls.DataBoundControl.PerformSelect()
at System.Web.UI.WebControls.BaseDataBoundControl.DataBind()
at System.Web.UI.WebControls.GridView.DataBind()
no luck.
In gridview.rowdatabound
Dim _dataKeyNames As String() = {"OFFICESUPPLY_ORDER_ID",
"STATUS_ID"}
gridview.DataKeyNames = _dataKeyNames
If e.Row.RowType = DataControlRowType.DataRow Then
gridview.DataKeys(e.Row.RowIndex)(1).ToString
End If
The app craps out at gridview.DataKeys(e.Row.RowIndex)(1).ToString on
row 0. the datakeynames are populated, there is a length of 2. I
just really am stuck.
Help is greatly appreciated.
Jason
Exception Details
System.ArgumentOutOfRangeException was caught
Message="Index was out of range. Must be non-negative and less than
the size of the collection.
Parameter name: index"
ParamName="index"
Source="mscorlib"
StackTrace:
at System.Collections.ArrayList.get_Item(Int32 index)
at System.Web.UI.WebControls.DataKeyArray.get_Item(Int32 index)
at cfoots_order_status.gridview_RowDataBound(Object sender,
GridViewRowEventArgs e) in
at
System.Web.UI.WebControls.GridView.OnRowDataBound(GridViewRowEventArgs
e)
at System.Web.UI.WebControls.GridView.CreateRow(Int32 rowIndex,
Int32 dataSourceIndex, DataControlRowType rowType, DataControlRowState
rowState, Boolean dataBind, Object dataItem, DataControlField[]
fields, TableRowCollection rows, PagedDataSource pagedDataSource)
at
System.Web.UI.WebControls.GridView.CreateChildControls(IEnumerable
dataSource, Boolean dataBinding)
at
System.Web.UI.WebControls.CompositeDataBoundControl.PerformDataBinding(IEnumerable
data)
at
System.Web.UI.WebControls.GridView.PerformDataBinding(IEnumerable
data)
at
System.Web.UI.WebControls.DataBoundControl.OnDataSourceViewSelectCallback(IEnumerable
data)
at
System.Web.UI.DataSourceView.Select(DataSourceSelectArguments
arguments, DataSourceViewSelectCallback callback)
at System.Web.UI.WebControls.DataBoundControl.PerformSelect()
at System.Web.UI.WebControls.BaseDataBoundControl.DataBind()
at System.Web.UI.WebControls.GridView.DataBind()