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

Custom Template and LoadOnDemand/ShowMoreResults/EnableVirtualScrolling

1 Answer 103 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Robert Vreeland
Top achievements
Rank 1
Robert Vreeland asked on 06 Sep 2008, 03:35 AM
I'd like to be able to do something like the sample at:

http://demos.telerik.com/aspnet/prometheus/ComboBox/Examples/PopulatingWithData/AutoCompleteSql/DefaultCS.aspx

In order to increase performance and not have all of the items loaded initially.

However I'm using a custom template to display multiple columns and am uncertain how to do it.  All of the examples assume one item / column and that you can just use an add method on the combobox to add additional items.

Here's my current code below.  Is there a way that i could achieve this?

<

telerik:RadComboBox ID="radcbxaccountnumber" runat="server" MaxLength="16" Width="160px" DropDownWidth="340" EnableEmbeddedSkins="false" Skin="WebIE7" AllowCustomText="true" MarkFirstMatch="true" Text='<%# DataBinder.Eval(database.duckds, "Tables(0).DefaultView.(0).txtvar1") %>' EnableLoadOnDemand="true" HighlightTemplatedItems="true" ItemRequestTimeout="500" OnItemsRequested="radcbxaccountnumber_ItemsRequested" OnItemDataBound="radcbxaccountnumber_ItemDataBound" ShowMoreResultsBox="true" EnableVirtualScrolling="true">

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

<tr><td style="width:75px;">Account#</td>

<td style="width:75px;">Name</td>

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

</tr></table></HeaderTemplate>

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

<tr><td style="width:75px;vertical-align:top;"><%#DataBinder.Eval(Container.DataItem, "txtvar1")%></td>

<td style="width:75px;vertical-align:top;"><%#DataBinder.Eval(Container.DataItem, "txtvar2")%></td>

<td style="width:100px;vertical-align:top;"><%#DataBinder.Eval(Container.DataItem, "reqtype", "{0}") + " " + DataBinder.Eval(Container.DataItem, "prodtype", "{0}")%></td>

</tr></table></ItemTemplate></telerik:RadComboBox>

and

Public

requestdataview As DataView

Protected Sub radcbxaccountnumber_ItemsRequested(ByVal sender As Object, ByVal e As Telerik.Web.UI.RadComboBoxItemsRequestedEventArgs)

requestdataview = database.FillDataViewWithCaching(

"getrelatedducks " + Request.QueryString("flockid") + ",1")

radcbxaccountnumber.DataSourceID =

""

radcbxaccountnumber.DataSource = requestdataview

radcbxaccountnumber.DataBind()

End Sub

Protected Sub radcbxaccountnumber_ItemDataBound(ByVal sender As Object, ByVal e As Telerik.Web.UI.RadComboBoxItemEventArgs)

e.Item.Text = (

DirectCast(e.Item.DataItem, DataRowView))("txtvar1").ToString()

e.Item.Value = (

DirectCast(e.Item.DataItem, DataRowView))("txtvar1").ToString()

End Sub

1 Answer, 1 is accepted

Sort by
0
Accepted
Veselin Vasilev
Telerik team
answered on 08 Sep 2008, 12:41 PM
Hello Robert Vreeland,

Please check this code library:
Multicolumn combo with LoadOnDemand and ShowMoreResults

Sincerely yours,
Veskoni
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
ComboBox
Asked by
Robert Vreeland
Top achievements
Rank 1
Answers by
Veselin Vasilev
Telerik team
Share this question
or