0

我设置了 LinqDataSource 和 RadComboBox,以便组合框按需显示查询结果。该表有 1000 行左右,加载该页面需要很长时间,因为出于某种原因 RadComboBox 一直在加载所有内容。

那么下面的代码有什么问题呢?我对代码隐藏文件中的 cbAuto 一无所知

<asp:LinqDataSource ID="LinqDataSource1" runat="server" 
ContextTypeName="Webshop.Entities" EntityTypeName="" OrderBy="Name, FromDate, TillDate"
Select="new (AutoID, Name, FromDate, TillDate, Comment)" TableName="Autos">
</asp:LinqDataSource>

<telerik:RadComboBox ID="cbAutos" runat="server" Width="900px"
        DropDownWidth="900px" EmptyMessage="Chosse an autotype"
        HighlightTemplatedItems="True"
         Filter="Contains" LoadingMessage="Loading..." DataTextField="Name"
 MaxHeight="300px" DataValueField="AutoID" ShowDropDownOnTextboxClick="False"
DataSourceID="LinqDataSource1" EnableLoadOnDemand="True" EnableVirtualScrolling="True" 
ItemsPerRequest="100">
                            <HeaderTemplate>
                                <table style="width: 850px;">
                                    <tr>
                                        <td style="width: 300px;">Autotype</td>
                                        <td style="width: 100px;">Date (from)</td>
                                        <td style="width: 100px;">Date (till)</td>
                                        <td style="width: 150px;">Comment</td>
                                    </tr>
                                </table>
                            </HeaderTemplate>
                            <ItemTemplate>
                                <table style="width: 850px;">
                                    <tr>
                                        <td style="width: 300px;">
                                            <%# DataBinder.Eval(Container.DataItem, "Name")%>
                                        </td>
                                        <td style="width: 100px;">
                                            <%# DataBinder.Eval(Container.DataItem, "FromDate")%>
                                        </td>
                                        <td style="width: 100px;">
                                            <%# DataBinder.Eval(Container.DataItem, "TillDate")%>
                                        </td>
                                        <td style="width: 150px;">
                                            <%# DataBinder.Eval(Container.DataItem, "Comment")%>
                                        </td>
                                    </tr>
                                </table>
                            </ItemTemplate>
                        </telerik:RadComboBox>
4

1 回答 1

0

请尝试其他Radcombobox属性EnableAutomaticLoadOndemand=true,这可以帮助您解决问题

于 2013-03-29T10:38:50.190 回答