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

Load on demand with webservice

5 Answers 156 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Teun
Top achievements
Rank 1
Teun asked on 21 Aug 2008, 08:31 AM
Hello,

We would like to implement a load on demand for the combobox in combination with a webservice to ease the dataload on the  page. We are wondering if you can provide us with an example with the following features:

  • combobox => initially empty
  • load items from webservice when clicked or when typing in the textbox (we understand that allowcustomtext cannot be turned off? )
  • display multiple columns in the dropdown
  • when an item is selected trigger another combobox to load items from a webservice

We would really appreciate your help. Thanks in advance.

5 Answers, 1 is accepted

Sort by
0
Rosi
Telerik team
answered on 21 Aug 2008, 11:33 AM
Hi Dennis ,

An example how to load items via WebService you can see here.

Note, that there is no way for now to implement multicolumn combo by using WebService. Actually you cannot apply templates when you are populating the ComboBox via WebService. This is the reason why you cannot apply Multi Column Combo via WebService.

You can implement an MultiCoulumncombo by using the general Loaad OnDemand functionality. An example can be seen here.

And how to implement related comboboxes you can see here.

Regards,
Rosi
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Teun
Top achievements
Rank 1
answered on 22 Aug 2008, 06:18 AM
Hi,

Thanks for the response. Too bad templating is not possible when using LOD with a webservice. That would be a neat feature. Is it something the team plans to implement in the near future?

Cheers.
0
Rosi
Telerik team
answered on 22 Aug 2008, 07:27 AM
Hi Dennis ,

We are always working on improving the controls suite and the client-side templates is definitely a feature we consider implementing and researching a possible options for its implementation. However for the time being I cannot set a timeframe  when this will be done.

Thank you for your feedback! We will have it mind for sure.


Regards,
Rosi
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Guss
Top achievements
Rank 2
answered on 10 Oct 2008, 10:35 AM
Hi There

I do load multiple columns using a web service.

 
for (int i = itemOffset; i < endOffset; i++)   
{  
RadComboBoxItemData itemData = new RadComboBoxItemData();   
 
string txtString = "<span class='ddcol1' style='width: 30px'>" + data.Rows[i]["title"].ToString() + "</span><span class='ddcol1' style='width:80px'>" + data.Rows[i]["first"].ToString() + "</span><span class='ddcol1' style='width:70px'>" + data.Rows[i]["middle"].ToString() + "</span><span class='ddcol1' style='width:80px'>" + data.Rows[i]["last"].ToString() + "</span><span class='ddcol1' style='width:175px'>" + data.Rows[i]["preDeploymentEmail"].ToString() + "</span>";   
   
itemData.Text = txtString;  
itemData.Value = data.Rows[i]["id"].ToString();   
result.Add(itemData);  
}  
 

The style looks like this:
.ddcol1 {float: left; margin: 0; padding: 0 5px 0 0; line-height: 14px; overflow:hidden; white-space:nowrap;}

 

Just one more issue:, the selected text in the combox is actually stuffed because it looks like this: 
<span class='ddcol1' style='width: 30px'>Mr.</span><span class='ddcol1' style='width:80px'>Guss</span><span class='ddcol1' style='width:70px'></span><span class='ddcol1' style='width:80px'>Davey</span><span class='ddcol1' style='width:175px'>gdavey@csc.com</span>
ITS ALL A STRING!!!

So if you can maybe help me on the last step, how do I then manipulate the selected TEXT in the combo?

0
Rosi
Telerik team
answered on 10 Oct 2008, 01:32 PM
Hello Guss,

I sugegst you  subscribe to the OnClientSelectedIndexChanged event and set the text of RadComboBox in its event handler.

For example
function OnClientSelectedIndexChanged (sender,e)  
{  
    var element=  e.get_item().get_element();  
    var children = element.getElementsByTagName("span")  
    var text ="";  
    for(var i=0;i<children.length; i++)  
   {  
        text += children[i].innerHTML;  
   }  
  sender.set_text(text);  
}  
 

Best wishes,
Rosi
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
ComboBox
Asked by
Teun
Top achievements
Rank 1
Answers by
Rosi
Telerik team
Teun
Top achievements
Rank 1
Guss
Top achievements
Rank 2
Share this question
or