I'm using RadGrid 2008.1.515.35 with an ArrayList as datasource and trying to make a hierarchical grid working with paging and virtual scrolling.
I've tried so hard by i couldn't make. First of all the paging is not presented. I'm sure that there is enough data to make pager visible but it is not.
This behaviour is strange because when i'm using 2008.1.414.35 version, the paging is shown. Below is the source code. Please what i'm doing wrong ?
Thanks in advance.
Best regards.
protected override void OnInit(EventArgs e){
RadGrid RadGrid1 = new RadGrid();
RadGrid1.NeedDataSource += new GridNeedDataSourceEventHandler(Grid_NeedDataSource);
RadGrid1.DetailTableDataBind += new GridDetailTableDataBindEventHandler(Grid_DetailTableDataBind);
RadGrid1.MasterTableView.DataKeyNames = new string[] { "Item_ID", "Parent_ID" };
RadGrid1.MasterTableView.ClientDataKeyNames = new string[] { "Item_ID", "Parent_ID" };
RadGrid1.MasterTableView.HierarchyLoadMode = GridChildLoadMode.Client;
RadGrid1.MasterTableView.SelfHierarchySettings.KeyName = "Item_ID";
RadGrid1.MasterTableView.SelfHierarchySettings.ParentKeyName = "Parent_ID";
RadGrid1.MasterTableView.GroupLoadMode = GridGroupLoadMode.Client;
RadGrid1.MasterTableView.TableLayout = GridTableLayout.Fixed;
RadGrid1.MasterTableView.PageSize = 10;
RadGrid1.MasterTableView.PagerStyle.Mode = GridPagerMode.NextPrevNumericAndAdvanced;
RadGrid1.MasterTableView.PagerStyle.Position = GridPagerPosition.Bottom;
RadGrid1.AllowPaging = true;
RadGrid1.VirtualItemCount = 1000;
RadGrid1.AllowCustomPaging = true;
RadGrid1.AllowSorting = true;
RadGrid1.AutoGenerateColumns = false;
RadGrid1.EnableLinqExpressions = true;
RadGrid1.Skin = "Office2007";
RadGrid1.GroupingEnabled = true;
RadGrid1.AllowMultiRowSelection = true;
RadGrid1.ShowGroupPanel = true;
RadGrid1.ClientSettings.AllowDragToGroup = true;
RadGrid1.ClientSettings.Selecting.AllowRowSelect = true;
RadGrid1.ClientSettings.Scrolling.AllowScroll = true;
RadGrid1.ClientSettings.Scrolling.UseStaticHeaders = true;
RadGrid1.ClientSettings.Scrolling.EnableVirtualScrollPaging = true;
RadGrid1.ClientSettings.Scrolling.SaveScrollPosition = true;
RadGrid1.ClientSettings.AllowColumnsReorder = true;
RadGrid1.ClientSettings.AllowExpandCollapse = true;
RadGrid1.ClientSettings.ReorderColumnsOnClient = true;
RadGrid1.ClientSettings.Resizing.AllowColumnResize = true;
RadGrid1.ClientSettings.Resizing.ResizeGridOnColumnResize = true;
RadGrid1.ClientSettings.ClientEvents.OnRowDblClick = "RowDblClick";
RadGrid1.ClientSettings.ClientEvents.OnRowClick = "OnRowClick";
RadGrid1.ClientSettings.ClientEvents.OnRowDeselected = "OnRowDeselected";
RadGrid1.ClientSettings.ClientEvents.OnRowSelected = "OnRowSelected";
RadGrid1.ClientSettings.ClientEvents.OnRowContextMenu = "RowContextMenu";
RadGrid1.MasterTableView.FilterExpression = "Parent_ID = 0";
//here a i create the grid columns
this.PlaceHolder.Controls.Add(RadGrid1);
}
protected void Grid_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
{
List<DItemVersion> items = Session["GenericItemList_Items"] as List<DItemVersion>;
if (items == null)
{
Grid.DataSource = new ArrayList();
}
else
{
int curIndex = Grid.CurrentPageIndex;
int maximum = Grid.MasterTableView.PageSize;
if ((curIndex + maximum) > items.Count - 1)
{
maximum = items.Count - curIndex;
}
Grid.DataSource = new ArrayList(items.GetRange(curIndex, maximum));
}
}
protected void Grid_DetailTableDataBind(object source, GridDetailTableDataBindEventArgs e)
{
GridTableView parentView = e.DetailTableView.ParentItem.OwnerTableView;
Telerik.Web.UI.DataKey parentKey = parentView.DataKeyValues[e.DetailTableView.ParentItem.ItemIndex];
e.DetailTableView.FilterExpression = "Parent_ID = " + parentKey["Item_ID"];
}