This is a migrated thread and some comments may be shown as answers.
Setting IsSeparator using WebService
2 Answers 34 Views
This is a migrated thread and some comments may be shown as answers.
Bob
Top achievements
Rank 1
Bob asked on 30 Jun 2010, 03:43 PM
Hello Telerik Team,

I have a client side Combo box that I am populating from a Web Service.  I would like to use the 'IsSeparator' functionality to populate the combo box with Separator items.

Is this possible using JSON results from the server?

Thanks
Bob

2 Answers, 1 is accepted

Sort by
0
Kalina
Telerik team
answered on 07 Jul 2010, 03:39 PM
Hello Bob,

Please accept my apology for the delayed reply.

I understand the issue that you describe, but I am afraid that IsSeparator property is not serialized.

However in your web method you can use the custom Attributes collection and add the IsSeparator property value as additional attribute to each item:

RadComboBoxItemData itemSeparator = new RadComboBoxItemData();
itemSeparator.Text = "separator item";
itemSeparator.Value = "separator item";
itemSeparator.Attributes["IsSeparator"] = true;
result.Add(itemSeparator);

Then at client-side you handle OnClientItemsRequested event, obtain the attribute value and set isSeparator accordingly.
<telerik:RadComboBox runat="server" ID="RadComboBox1"  
    OnClientItemsRequested="OnClientItemsRequestedHandler">
function OnClientItemsRequestedHandler(sender, eventArgs)
{
   var items = sender.get_items();
    
   for(var i = 0; i < items.get_count(); i ++)
   {
        var item = items.getItem(i);
        if(item.get_attributes().getAttribute("IsSeparator"))
            item.set_isSeparator(item.get_value());
   }
     
}

Feel free to contact us if you have additional questions.

All the best,
Kalina
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Bob
Top achievements
Rank 1
answered on 07 Jul 2010, 03:43 PM
Thanks Kalina,

I did not see the set_isSeparator Client API!  That's great news as that is what I was prepared to do...
Asked by
Bob
Top achievements
Rank 1
Answers by
Kalina
Telerik team
Bob
Top achievements
Rank 1
Share this question
or