Hi,
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 :
JS Code :
C# Code WS :
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"
AllowCustomText
=
"true"
ItemRequestTimeout
=
"1000"
Filter
=
"Contains"
ShowDropDownOnTextboxClick
=
"false"
MinFilterLength
=
"2"
EnableLoadOnDemand
=
"true"
EnableVirtualScrolling
=
"true"
ShowToggleImage
=
"false"
OnClientFocus
=
"ChangeOu"
OnClientItemsRequesting
=
"OnClientItemsRequesting"
>
<
webservicesettings
method
=
"GetLieu"
path
=
"~/Utils/WebService/Utils.asmx"
/>
</
telerik:RadComboBox
>
JS Code :
function
OnClientItemsRequesting(sender, eventArgs) {
var
context = eventArgs.get_context();
context[
"coffret"
] =
"16"
;
}
function
ChangeOu(sender) {
var
lieu = $find(
"MRech_MRLieu"
);
lieu.clearSelection();
lieu.clearItems();
}
C# Code WS :
[WebMethod]
[ScriptMethod]
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();
result.Add(itemData);
}
data.Dispose();
cnnUtil.Dispose();
return
result.ToArray();
}