RadTreeList未在页面加载时加载

时间:2013-05-08 06:08:49

标签: c# asp.net telerik

我遇到RadTreeList的问题,它没有在页面加载时加载。 RadTreeList位于RadMultiPage内。代码是这样的:

<telerik:RadTabStrip ID="RadTabStrip1" runat="server" MultiPageID="RadMultiPage1" SelectedIndex="0" ReorderTabsOnSelect="true" Align="Justify" Width="220px">
    <Tabs>
        <telerik:RadTab Text="<%$Resources:Strings,Stores %>">
        </telerik:RadTab>
        <telerik:RadMultiPage ID="RadMultiPage1" runat="server" Width="100%">
            <telerik:RadPageView ID="StoresPageView" runat="server">
                <telerik:RadAjaxPanel ID="Ajpanel" runat="server">
                    <telerik:RadTreeList ID="StoreTreeList" runat="server" HideExpandCollapseButtonIfNoChildren="true"
                        ParentDataKeyNames="PARENT_STORE_ID" DataKeyNames="STORE_ID" AllowPaging="false" GridLines="Horizontal"
                        AutoGenerateColumns="false" AllowSorting="true" AllowMultiItemSelection="true" OnNeedDataSource="StoreTreeList_NeedDataSource">
                        <ItemStyle HorizontalAlign="Left" />
                        <ClientSettings><Scrolling UseStaticHeaders="true"  AllowScroll="true"  /> </ClientSettings>
                        <Columns>
                            <telerik:TreeListSelectColumn  ></telerik:TreeListSelectColumn>
                            <telerik:TreeListTemplateColumn  Display="false" >
                                <ItemTemplate>
                                    <asp:HiddenField ID="hf_StoreID" runat="server" Value='<%# Eval("STORE_ID") %>' />
                                </ItemTemplate>
                            </telerik:TreeListTemplateColumn>
                            <telerik:TreeListBoundColumn DataField="STORE_NAME" HeaderText="Stores" >
                            </telerik:TreeListBoundColumn>
                        </Columns>
                    </telerik:RadTreeList>
                </telerik:RadAjaxPanel>
            </telerik:RadPageView>

服务器端:

protected void StoreTreeList_NeedDataSource(object sender,TreeListNeedDataSourceEventArgs e)
{
    BindTreeList();
}

private void BindTreeList()
{
   StoresDT.Select("STORE_ID=" + new WebSiteDataHelper().SelectedStoreID.Value)[0]["PARENT_STORE_ID"] = 0;
   StoreTreeList.DataSource = StoresDT;
}

protected void Page_Load(object sender, EventArgs e)
{
     if (!IsPostBack)
     {
          StoreTreeList.ExpandAllItems();
     }
}

0 个答案:

没有答案