Hi!
I'm using multiple RadComboBoxes that are filled by a web service like this:
1.
<
telerik:RadComboBox
runat
=
"server"
ID
=
"Value"
Width
=
"300px"
EnableLoadOnDemand
=
"true"
OnClientItemsRequesting
=
"LookupItemRequesting"
OnItemsRequested
=
"Value_OnItemsRequested"
AutoPostBack
=
"False"
>
2.
<
WebServiceSettings
Path
=
"/Handlers/IdmpService.asmx"
Method
=
"LoadDropDownValues"
UseHttpGet
=
"true"
></
WebServiceSettings
>
3.
</
telerik:RadComboBox
>
The method to fill the combobox looks like this:
01.
[WebMethod(
true
)]
02.
[ScriptMethod(UseHttpGet =
true
)]
03.
public
RadComboBoxData LoadDropDownValues(RadComboBoxContext context)
04.
{
05.
var res =
new
RadComboBoxData();
06.
var itemType = context[
"ItemType"
].AsString();
07.
var valueProperty = context[
"ValueProperty"
].AsString();
08.
...
09.
var result =
new
List<RadComboBoxItemData>();
10.
try
11.
{
12.
...
13.
foreach
(Dictionary<
string
,
object
> item
in
items)
14.
{
15.
// process items...
16.
result.Add(
new
RadComboBoxItemData { Value =
"some integer id"
, Text =
string
.Join(
", "
,
string
.Format(displayFormat, values.ToArray())) });
17.
}
18.
}
19.
catch
(Exception ex)
20.
{
21.
result =
new
List<RadComboBoxItemData> {
new
RadComboBoxItemData { Value =
""
, Text = ex.Message } };
22.
}
23.
res.Items = result.ToArray();
24.
return
res;
25.
}
Together with quite a few other Telerik controls this is a form used to view/edit data, so I need to set a specific value for thie ComboBox. How can I assign a value to the ComboBox to make sure that when I save the whole data, I can read the correct value from the ComboBox?
Thanks!