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

Error : Selection out of range Parameter name : Value

2 Answers 112 Views
This is a migrated thread and some comments may be shown as answers.
mathieu emptoz
Top achievements
Rank 1
mathieu emptoz asked on 05 Jul 2012, 09:16 AM

I have a problem since few days with the RadCombox on LoadOnDemande.
The load is OK, but when i select an item in the list and i post the page, i have an error message : "Selection out of range Parameter name : Value"

I don't understand the problem, the same code worked before.

Thanks for help

Aspx code :
<telerik:RadComboBox ID="MRLieu" runat="server"
           <webservicesettings method="GetLieu" path="~/Utils/WebService/Utils.asmx" />

JS Code :
function OnClientItemsRequesting(sender, eventArgs) {
    var context = eventArgs.get_context();
    context["coffret"] = "16";
function ChangeOu(sender) {
    var lieu = $find("MRech_MRLieu");

C# Code WS :
public RadComboBoxItemData[] GetLieu(object context)
  IDictionary<string, object> contextDictionary = (IDictionary<string, object>)context;
  string txt = contextDictionary["Text"].ToString();
  int coffret = Convert.ToInt32(contextDictionary["coffret"]);
  txt = txt.Replace("'", " ");
  txt = txt.Replace("\"", " ");
  txt = string.Concat("\"", txt, "*\"");
  string sql = @"MyRequest";
  ConnexionUtil cnnUtil = new ConnexionUtil();
  DataTable data = cnnUtil.ExecuteRequeteDataTable(sql);
  int itemOffset = Convert.ToInt32(contextDictionary["NumberOfItems"]);
  int endOffset = Math.Min(itemOffset + NBITEMS, data.Rows.Count);
  List<RadComboBoxItemData> result = new List<RadComboBoxItemData>();
  RadComboBoxItemData itemData;
  for (int i = itemOffset; i < endOffset; i++)
    itemData = new RadComboBoxItemData();
    itemData.Text = data.Rows[i]["nom"].ToString();
    itemData.Value = data.Rows[i]["id"].ToString();
  return result.ToArray();

2 Answers, 1 is accepted

Sort by
Telerik team
answered on 09 Jul 2012, 03:07 PM
Hello Mathieu,

I tested the case following your code as closely as possible, but everything worked as expected. Can you review the attached sample and let me know if I am missing something?
(You need to type any two digits, e.g. "22", or "35" in the combobox input area.)

Kind regards,
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
mathieu emptoz
Top achievements
Rank 1
answered on 10 Jul 2012, 08:25 AM
Thanks for response !

It was a problem with my page !
A bad DataBind...
Asked by
mathieu emptoz
Top achievements
Rank 1
Answers by
Telerik team
mathieu emptoz
Top achievements
Rank 1
Share this question