我正在尝试加载树形图,一切正常但我总是看到“没有记录显示”。
以下是控件:
<telerik:RadTreeList ID="trlProductGroups" runat="server" AllowPaging="true" PageSize="5"
DataKeyNames="ID" ParentDataKeyNames="PARENT_ID" AutoGenerateColumns="false"
OnInsertCommand="trlProductGroups_InsertCommand" OnNeedDataSource="trlProductGroups_NeedDataSource"
OnUpdateCommand="trlProductGroups_UpdateCommand" OnDeleteCommand="trlProductGroups_DeleteCommand">
<Columns>
<telerik:TreeListEditCommandColumn UniqueName="InsertCommandColumn" ButtonType="ImageButton"
HeaderStyle-Width="60px" ItemStyle-HorizontalAlign="Center" />
<telerik:TreeListEditCommandColumn UniqueName="EditCommandColumn" ButtonType="ImageButton">
<ItemStyle CssClass="MyImageButton" />
</telerik:TreeListEditCommandColumn>
<telerik:TreeListButtonColumn UniqueName="DeleteCommandColumn" Text="Delete" CommandName="Delete"
ButtonType="ImageButton" />
<telerik:TreeListBoundColumn DataField="ID" UniqueName="ID" HeaderText="Grup ID"
ReadOnly="true" />
<%-- <telerik:TreeListTemplateColumn DataField="GROUP_NAME" UniqueName="GROUP_NAME" HeaderText="Grup Adı">
<EditItemTemplate>
<asp:TextBox ID="txtGroupName" runat="server"></asp:TextBox>
</EditItemTemplate>
</telerik:TreeListTemplateColumn>--%>
<telerik:TreeListBoundColumn DataField="GROUP_NAME" UniqueName="GROUP_NAME" HeaderText="Grup Adı" />
<telerik:TreeListBoundColumn DataField="PARENT_ID" UniqueName="PARENT_ID" HeaderText="Ana Grup ID"
ReadOnly="true" />
</Columns>
</telerik:RadTreeList>
这是NeedDataSource代码:
protected void trlProductGroups_NeedDataSource(object sender, TreeListNeedDataSourceEventArgs e)
{
WebAppTest.Objects.ProductGroups pGroups = new WebAppTest.Objects.ProductGroups();
DataTable dt = pGroups.SelectData(null, string.Empty);
trlProductGroups.DataSource = dt;
}
我可以在DataTable中看到数据,但是treelist不会加载数据。我有什么错误吗?
由于
答案 0 :(得分:0)
需要的是,数据源中至少有一个数据具有null id父值。也许有帮助。