<telerik:RadAjaxManager ID="RadAjaxMgr" runat="server" > |
<AjaxSettings> |
<telerik:AjaxSetting AjaxControlID="RadGrid1"> |
<UpdatedControls> |
<telerik:AjaxUpdatedControl ControlID="RadGrid1" /> |
</UpdatedControls> |
</telerik:AjaxSetting> |
</AjaxSettings> |
</telerik:RadAjaxManager> |
<telerik:RadGrid ID="RadGrid1" AutoGenerateColumns="true" ShowHeader="true" runat="server" |
Width="97%" GridLines="None" OnNeedDataSource="RadGrid1_NeedDataSource" OnDetailTableDataBind="RadGrid1_DetailTableDataBind"> |
<MasterTableView Name="Master" DataKeyNames="Id, Parent_id" GridLines="Both" PageSize="15" |
HierarchyDefaultExpanded="true" HierarchyLoadMode=ServerOnDemand> |
<SelfHierarchySettings KeyName="id" ParentKeyName="Parent_id" /> |
</MasterTableView> |
</telerik:RadGrid> |
Protected Sub RadGrid1_NeedDataSource(ByVal source As Object, ByVal e As Telerik.Web.UI.GridNeedDataSourceEventArgs) Handles RadGrid1.NeedDataSource |
If Not e.IsFromDetailTable Then |
RadGrid1.DataSource = GetDataTable(" SELECT ID, P_ID FROM MY_TB order by ordnl_pos ") |
End If |
End Sub |
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load |
If Not IsPostBack Then |
RadGrid1.MasterTableView.FilterExpression = "P_ID IS NULL" |
End If |
End Sub |
When the Page loads it displays only the parent rows. The parent rows have the expand/collapse column but no child rows.
If I take out the filter on Page_Load it returns ALL rows but there are at the same level (no hierarchy)
Any suggestions?
Thanks.