I'm trying to use the code below to perform a batch update in a RadGrid but I'm getting the error below. I was able to get this to work fine in C# but now I need to get it to work in VB.net
Error:
Selection out of range
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: Selection out of range
Parameter name: value
Protected Sub gvGrossPayroll_ItemCommand(ByVal sender As Object, ByVal e As GridCommandEventArgs)
If e.CommandName = "UpdateAll" Then
For Each editedItem As GridEditableItem In gv_grosspayroll.EditItems
Dim newValues As New Hashtable()
e.Item.OwnerTableView.ExtractValuesFromItem(newValues, editedItem)
Update_PayrollRecord(editedItem.GetDataKeyValue("ID"), Convert.ToDecimal(newValues("PayrollAmount")))
Next
End If
gv_grosspayroll.Rebind()
End Sub
Error:
Selection out of range
Parameter name: value
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: Selection out of range
Parameter name: value
4 Answers, 1 is accepted
0
Hi Christian,
Could you please try changing your logic as shown in the following online example and let me know if you experience any problems:
Client edit with batch server update
Or send us a sample example where we could replicate the issue in order to debug it locally and get to the source of the issue. You could open a formal support ticket from your Telerik account and attach a ZIP file there. Thus we will be able to gather more details about your scenario and to provide you a solution.
Looking forward for your reply.
Regards,
Radoslav
the Telerik team
Could you please try changing your logic as shown in the following online example and let me know if you experience any problems:
Client edit with batch server update
Or send us a sample example where we could replicate the issue in order to debug it locally and get to the source of the issue. You could open a formal support ticket from your Telerik account and attach a ZIP file there. Thus we will be able to gather more details about your scenario and to provide you a solution.
Looking forward for your reply.
Regards,
Radoslav
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0

WCRA Dev
Top achievements
Rank 1
answered on 12 Jan 2011, 06:19 PM
I've narrowed down the problem to the code that opens the datagrid for editing.
This code works fine the first it is called during the rendering of the page but when this code is called a second time after an update I get the error message:
Selection out of range
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: Selection out of range
Parameter name: value
Source Error:
Stack Trace:
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1
Protected Sub gvGrossPayroll_PreRender(ByVal sender As Object, ByVal e As EventArgs)
For Each item As GridItem In gv_grosspayroll.MasterTableView.Items
If TypeOf item Is GridEditableItem Then
Dim editableItem As GridEditableItem = TryCast(item, GridDataItem)
editableItem.Edit = True
End If
Next
gv_grosspayroll.Rebind()
End Sub
This code works fine the first it is called during the rendering of the page but when this code is called a second time after an update I get the error message:
Selection out of range
Parameter name: value
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: Selection out of range
Parameter name: value
Source Error:
An unhandled exception was generated during the execution of the current
web request. Information regarding the origin and location of the
exception can be identified using the exception stack trace below.
|
Stack Trace:
[ArgumentOutOfRangeException: Selection out of range Parameter name: value] Telerik.Web.UI.RadComboBox.PerformDataBinding(IEnumerable dataSource) +299 Telerik.Web.UI.RadComboBox.OnDataSourceViewSelectCallback(IEnumerable data) +299 System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +33 Telerik.Web.UI.RadComboBox.OnDataBinding(EventArgs e) +661 Telerik.Web.UI.RadComboBox.PerformSelect() +21 System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +74 Telerik.Web.UI.RadComboBox.DataBind() +38 System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +66 Telerik.Web.UI.RadComboBox.OnPreRender(EventArgs e) +24 System.Web.UI.Control.PreRenderRecursiveInternal() +103 System.Web.UI.Control.PreRenderRecursiveInternal() +175 System.Web.UI.Control.PreRenderRecursiveInternal() +175 System.Web.UI.Control.PreRenderRecursiveInternal() +175 System.Web.UI.Control.PreRenderRecursiveInternal() +175 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2496 |
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1
0

WCRA Dev
Top achievements
Rank 1
answered on 13 Jan 2011, 08:29 PM
How do I modify the code below or the example that you gave a link to so that it can get it's values for the batch update from a RadNemericTextBox in a RadGrid?
Protected Sub gvGrossPayroll_ItemCommand(ByVal sender As Object, ByVal e As GridCommandEventArgs)
If e.CommandName = "UpdateAll" Then
For Each editedItem As GridEditableItem In gv_grosspayroll.EditItems
Dim newValues As New Hashtable()
e.Item.OwnerTableView.ExtractValuesFromItem(newValues, editedItem)
Update_PayrollRecord(editedItem.GetDataKeyValue("ID"), Convert.ToDecimal(editedItem("PayrollAmount")))
Next
End If
gv_grosspayroll.Rebind()
End Sub
0
Hello Christian,
Into the provided example the edit controls are TextBoxes which into the RadGrid1_ItemCreated are extended through RadInputManager. The txtUnitPrice and txtUnitsOnOrder textboxes are extended via NumericTextBoxSetting. In this case the targeted textbox will be accepting numeric input. More information about Radinput manager you could find here:
http://www.telerik.com/help/aspnet-ajax/using_radinputmanager.html
If you want to avoid using the TextBox and extend it you could try adding the RadNumericTextBox into the GridTemplateColumn's ItemTemplate. Then into the
I hope this helps.
Kind regards,
Radoslav
the Telerik team
Into the provided example the edit controls are TextBoxes which into the RadGrid1_ItemCreated are extended through RadInputManager. The txtUnitPrice and txtUnitsOnOrder textboxes are extended via NumericTextBoxSetting. In this case the targeted textbox will be accepting numeric input. More information about Radinput manager you could find here:
http://www.telerik.com/help/aspnet-ajax/using_radinputmanager.html
If you want to avoid using the TextBox and extend it you could try adding the RadNumericTextBox into the GridTemplateColumn's ItemTemplate. Then into the
UpdateValues
() method you could get the RadNumericTextBox value and update the database:Protected
Sub
UpdateValues(
ByVal
updatedItem
As
GridDataItem)
Dim
numericTxtBox
As
TextBox =
CType
(updatedItem.FindControl(
"numericTextBoxID"
), RadNumericTextBox)
SqlDataSource1.UpdateParameters(
"DataField"
).DefaultValue = numericTxtBox.Text
....
I hope this helps.
Kind regards,
Radoslav
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.