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

[Solved] Load on demand example - how to display multi-cols?

17 Answers 352 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Jon
Top achievements
Rank 1
Jon asked on 21 Feb 2008, 06:51 PM

How do display multiple columns in the load by demand example?
The following code from the multi-col does not display the data.
Do I have to bind the datatable to the combox for this to work.
It seems the databinding to the radcombo takes a while.. thanks in advance.

<

HeaderTemplate>

<table style="width: 100%; text-align: left">

<tr>

<td style="width: 125px;">

Company Name

</td>

<td style="width: 125px;">

City

</td>

<td style="width: 125px;">

Title

</td>

</tr>

</table>

</HeaderTemplate>

<ItemTemplate>

<table style="width: 100%; text-align: left">

<tr>

<td style="width: 125px;">

<%

# DataBinder.Eval(Container.DataItem, "CompanyName") %>

</td>

<td style="width: 125px;">

<%

# DataBinder.Eval(Container.DataItem, "City") %>

</td>

<td style="width: 125px;">

<%

# DataBinder.Eval(Container.DataItem, "ContactTitle") %>

</td>

</tr>

</table>

</ItemTemplate>

17 Answers, 1 is accepted

Sort by
0
Rosi
Telerik team
answered on 22 Feb 2008, 04:57 PM
Hi Jon Elster,

You need to call DataBind() method of RadComboBoxItems. This will evaluate the databinding expressions.

For an example you can see our online demo-http://www.telerik.com/DEMOS/ASPNET/Prometheus/Combobox/Examples/Functionality/MultiColumnCombo/DefaultCS.aspx

Greetings,
Rosi
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Jon
Top achievements
Rank 1
answered on 22 Feb 2008, 08:15 PM
It appears the databinding takes a  second and is performance 'expensive'.
Is thier anyway around it?
I'd like to get the performace like the load by demand example.
I'm looking for a fast multi-column load by demand example
thanks
0
Rosi
Telerik team
answered on 25 Feb 2008, 04:33 PM
Hi Jon Elster,

You can add items at runtime in the ItemsRequested event of RadComboBox without using databindings.

For an example:
   Protected Sub RadComboBox1_ItemsRequested(ByVal sender As ObjectByVal e As RadComboBoxItemsRequestedEventArgs)  
                      RadComboBox1.Items.Add(new RadComboBoxItem("text""value")    
      End Sub 
 

Hope this helps.

Kind regards,
Rosi
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Jon
Top achievements
Rank 1
answered on 25 Feb 2008, 04:36 PM
Yes.. but how can you 'do' multi-columns and still be super fast?
thanks again
0
Nikolay
Telerik team
answered on 26 Feb 2008, 05:32 PM
Hi Jon Elster,

This would not be an easy task and it would slow down the combobox' performance. You can, however, try to use RadGrid inside combobox, as shown at:

LOD Grid in ComboBox

Kind regards,
Nick
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Angela
Top achievements
Rank 1
answered on 08 Mar 2009, 04:43 PM
When I goto this example in the demo it is not working.  Is there a working version somewhere..

I tpe in 104 into the text part and nothing happens?
0
Veselin Vasilev
Telerik team
answered on 09 Mar 2009, 08:52 AM
Hello Angela,

Please type 104 and click on the dropdown arrow to open the combobox.

Kind regards,
Veselin Vasilev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Angela
Top achievements
Rank 1
answered on 09 Mar 2009, 12:31 PM
Hi thanks,

So this really is not a on load demand scenario?  Meaning when someone types you expect the load to begin then.  And it doesn't have the more capability at the bottom for paging.

and if I type "10" it won't do anything.

thanks, for the help I now know this won't work for my requirements.
0
Veselin Vasilev
Telerik team
answered on 09 Mar 2009, 01:41 PM
Hi Angela,

That example does not show load on demand combobox, but a load on demand grid.
This example shows a multi-column combobox with load on demand

All the best,
Veselin Vasilev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Angela
Top achievements
Rank 1
answered on 09 Mar 2009, 01:46 PM
Thanks for your response :)

That example, unfortunately, does *not* show an on load demand with multi columns

This is your demo code below.  In the *demo* code you do not see the following three lines.  They are not there.
 

ShowMoreResultsBox="true"
EnableLoadOnDemand="true"
EnableVirtualScrolling = "true"

 

in its definition.

Demo code combo definition.

<telerik:RadComboBox  
                    runat="server" ID="RadComboBox1"   
                 Height="190px" Width="420px"   
                 Skin="Vista" 
                    MarkFirstMatch="true"   
                    DataSourceID="SessionDataSource1"   
                    EnableLoadOnDemand="true"   
                    HighlightTemplatedItems="true" 
                    OnClientItemsRequested="UpdateItemCountField"   
                    OnDataBound="RadComboBox1_DataBound"   
                    OnItemDataBound="RadComboBox1_ItemDataBound" 
                    OnItemsRequested="RadComboBox1_ItemsRequested">  
                    <HeaderTemplate> 
                        <ul> 
                         <li class="col1">Contact Name</li> 
                         <li class="col2">City</li> 
                         <li class="col3">Title</li> 
                        </ul> 
                    </HeaderTemplate> 
                    <ItemTemplate> 
                        <ul> 
                         <li class="col1"><%# DataBinder.Eval(Container.DataItem, "ContactName") %></li>  
                         <li class="col2"><%# DataBinder.Eval(Container.DataItem, "City") %></li>  
                         <li class="col3"><%# DataBinder.Eval(Container.DataItem, "ContactTitle") %></li>  
                        </ul> 
                    </ItemTemplate> 
                    <FooterTemplate> 
                     A total of <asp:Literal runat="server" ID="RadComboItemsCount" /> items  
                    </FooterTemplate> 
                </telerik:RadComboBox> 
 
0
Veselin Vasilev
Telerik team
answered on 09 Mar 2009, 02:05 PM
Hello Angela,

The demo does show load on demand. The EnableLoadOnDemand property is set to True and the combobox is subscribed to ItemsRequested event.
I suppose you expected to have VirtualScrolling / ShowMoreResults.

In order to have these you should not call the DataBind method in ItemsRequested event. Instead, you should manually iterate through the Rows of the dataset and create the combo's items as shown in this example.

I hope it will be straighforward for you to combine both examples.

Best wishes,
Veselin Vasilev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Jay
Top achievements
Rank 1
answered on 15 Jul 2009, 07:45 PM

In the last example you reference, they are adding a RadComboBoxItem in the ItemsRequested server-side event. How do you set an item with more than one value, ie. col1,col2,col3. The RadComboBoxItem only has 2 values, one for the text and one for the value. How can the item template of the combobox bind to more than one value and how you do this binding with enablevirtualscrolling=true?
Thanks,

Jay

0
Yana
Telerik team
answered on 16 Jul 2009, 01:06 PM
Hi Jay,

Please find attached a simple page demonstrating the needed approach.


All the best,
Yana
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Jay
Top achievements
Rank 1
answered on 17 Jul 2009, 06:35 PM
Thanks a lot! It works great now using that example!

jay
0
Jill McLoughlin
Top achievements
Rank 1
answered on 17 Mar 2010, 07:28 PM
Can I still ask about this post?  I used the example but it is in C, can you show me how to access attributes in VB?  I got everything except for the "Attributes[\"Address\"]" to work.  Now when my combo loads there is no data there (but it does show the offset on the bottom).
0
Jay
Top achievements
Rank 1
answered on 17 Mar 2010, 07:52 PM
Well, I am not sure what you are really asking. The attributes collection is pretty straightforward to get in vb.net. For example, I am not using "Address" but "Level1" in the below example:

item template of the  combo within the aspx:

<

 

ItemTemplate>

 

 

<table style="width: 450px; text-align: left">

 

 

<tr>

 

 

<td style="width: 100px;">

 

<%

#DataBinder.Eval(Container, "Attributes(""Level1"")")%>

 

 

</td>

 

 

<td style="width: 150px;">

 

<%

#DataBinder.Eval(Container, "Attributes(""Level2"")")%>

 

 

</td>

 

 

<td style="width: 200px;">

 

<%

#DataBinder.Eval(Container, "Attributes(""Level3"")")%>

 

 

</td>

 

 

</tr>

 

 

</table>

 

 

</ItemTemplate>



in server-side code of the itemsrequested event i have this:

 

oCBItem =

New RadComboBoxItem()

 

oCBItem.Attributes.Add(

"Level1", "val for first col")

 

oCBItem.Attributes.Add(

"Level2", "val for second col")

 

oCBItem.Attributes.Add(

"Level3", "val for third col")

 

rcboSystem.Items.Add(oCBItem)

oCBItem.DataBind()


Maybe your problem is that your aspx field does not match your code behind field within the itemseventrequested  event. Hope that helps.

0
Jill McLoughlin
Top achievements
Rank 1
answered on 17 Mar 2010, 07:59 PM
That was what I was looking for, thank you - it works beautifully now!
Tags
ComboBox
Asked by
Jon
Top achievements
Rank 1
Answers by
Rosi
Telerik team
Jon
Top achievements
Rank 1
Nikolay
Telerik team
Angela
Top achievements
Rank 1
Veselin Vasilev
Telerik team
Jay
Top achievements
Rank 1
Yana
Telerik team
Jill McLoughlin
Top achievements
Rank 1
Share this question
or