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

Getting items via webservice clears what was typed in.

0 Answers 19 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
Edward asked on 07 Dec 2012, 10:11 PM
I have a Usercontrol with a RadComboBox that gets items via a webservice.
Everything is working correctly, however when I type, the search text disappears.
I had the same exact behavior with postbacks, but now its not posting back, and it is still doing the same thing.

Please take a look at the code below.
Here is the code for the RadComboBox:
    EmptyMessage="-- Select --"
    <WebServiceSettings Method="GetContentProviderData" Path="../../WebService/BoomboxWs.asmx" />
    <ExpandAnimation Type="InOutElastic" />

Here is the code for CP_ItemChecked:
function CP_ItemChecked(sender, eventArgs) {
    var data = '{ "type": "' + sender.get_id() + '", "id": "' + eventArgs.get_item().get_value() + '" }';
        type: "POST",
        url: "../../WebService/BoomboxWs.asmx/MarkSelectedItem",
        data: data,
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        success: function (msg) {

Here is the WebMethod:
[WebMethod(EnableSession = true)]
public RadComboBoxData GetContentProviderData(RadComboBoxContext context)
    return GetRadComboBoxData(context, DtCp, DtCp.Count());
public RadComboBoxData GetRadComboBoxData(RadComboBoxContext context, List<GenericDataList> data, int itemsPerRequest = 20)
    var comboData = new RadComboBoxData();
    var itemOffset = context.NumberOfItems;
    var endOffset = itemOffset + itemsPerRequest;
    if (endOffset > data.Count())
        endOffset = data.Count();
    if (!string.IsNullOrEmpty(context.Text))
        data = data.Where(q => q.Name.ToUpper().Contains(context.Text.ToUpper())).ToList();
    comboData.EndOfItems = endOffset == data.Count();
    var result = new List<RadComboBoxItemData>(endOffset - itemOffset);
        .Select(radItem => new RadComboBoxItemData {Text = radItem.Name, Value = radItem.Id.ToString(CultureInfo.InvariantCulture)}));
    comboData.Message = data.Any() ? String.Format("Items <b>1</b>-<b>{0}</b> out of <b>{1}</b>", endOffset, data.Count()) : "No matches";
    comboData.Items = result.ToArray();
    return comboData;

No answers yet. Maybe you can help?

Asked by
Top achievements
Rank 1
Share this question