This is a migrated thread and some comments may be shown as answers.

[Solved] "Selection out of range" when editing RadComboBox

1 Answer 142 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Zlatko Rusev
Top achievements
Rank 1
Zlatko Rusev asked on 06 Nov 2009, 02:06 PM
Hi,
I use RadDatagrid template column. In EditItemTemplate I put RadComboBox. Values for it I suplly in ItemDataBound event.
The problem is when I try to edit a row, I receive an error message:

Selection out of range
Parameter name: value

In spite of value of edited field exists in RadComboBox items.

Please help me with this issue

Best Ragards
Zl. Rusev

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 09 Nov 2009, 06:31 AM
Hello Zl.Rusev,

The reason for this error is that the value you set as selected in the RadComboBox does not exist in the list of Items already loaded in the control. In case where the bound column allows NULL values, the best way to avoid the error is to select empty strings instead of the NULLs or convert them to empty strings after the data is selected. Finally, an Item with value = String.Empty or "" should exist in the ComboBox. So in order to avoid server exception when passing null value to the combobox, try setting AppendDataBoundItems = true and include an empty item to the RadComboBox control.

Also refer to this kb article to get more information on Using RadComboBox as editor in template column of RadGrid.

Thanks
Princy.
Tags
Grid
Asked by
Zlatko Rusev
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or