I have a RadGrids that resize the height with the window. That has been working for several years in 6 different grids with almost identical code. In one of these grids all of sudden, on a new page/refresh the grid rows go to about 10 pixels high. If I resize the window it all goes back to normal. I have tried many different things to get open a new page for the grid to be 100% in the panel it is in. I am lost, I did not change anything, the ASP.NET Ajax drop was working fine and suddenly this problem appears with one of six grids. Programming is not supposed to work this way.
<
script
type
=
"text/javascript"
>
$(document).ready(function () {
SetGridDiv();
});
window.onresize = function (event) {
SetGridDiv();
}
function SetGridDiv() {
var height = $(window).height();
var gridDiv = document.getElementById("MainContent_GridDiv");
height = height - 100;
height += "px";
gridDiv.style.height = height;
}
</
script
>
<
div
id
=
"GridDiv"
runat
=
"server"
>
<
asp:panel
runat
=
"server"
ID
=
"HomeGridPanel"
CssClass
=
"windowPercent"
>
<
telerik:RadGrid
runat
=
"server"
ID
=
"OrganizationsGrid"
OnItemCommand
=
"Grid_ItemCommand"
>
<
ClientSettings
>
<
ClientEvents
OnRowDblClick
=
"RowDblClick"
/>
</
ClientSettings
>
</
telerik:RadGrid
>
</
asp:panel
>
</
div
>
And the C# .cs code.
RadGrid adminGrid = OrganizationsGrid;
adminGrid.NeedDataSource += new GridNeedDataSourceEventHandler(AdminGrid_NeedDataSource);
adminGrid.Skin = "Default";
adminGrid.AutoGenerateColumns = false;
adminGrid.EnableViewState = false;
adminGrid.GroupingEnabled = false;
adminGrid.AllowPaging = true;
adminGrid.PageSize = 500;
adminGrid.Height = Unit.Percentage(100);
adminGrid.EnableHeaderContextMenu = true;
adminGrid.AllowSorting = true;
adminGrid.AllowFilteringByColumn = true;
adminGrid.AllowMultiRowSelection = false;
adminGrid.AllowAutomaticDeletes = true;
adminGrid.MasterTableView.HierarchyDefaultExpanded = true;
adminGrid.ClientSettings.EnableRowHoverStyle = true;
adminGrid.ClientSettings.Selecting.AllowRowSelect = true;
adminGrid.ClientSettings.Selecting.EnableDragToSelectRows = true;
adminGrid.ClientSettings.ReorderColumnsOnClient = true;
adminGrid.ClientSettings.AllowColumnsReorder = true;
adminGrid.ClientSettings.ColumnsReorderMethod = GridClientSettings.GridColumnsReorderMethod.Reorder;
adminGrid.ClientSettings.Virtualization.EnableVirtualization = true;
adminGrid.ClientSettings.Virtualization.InitiallyCachedItemsCount = 2000;
adminGrid.ClientSettings.Scrolling.AllowScroll = true;
adminGrid.ClientSettings.Scrolling.UseStaticHeaders = true;
adminGrid.ClientSettings.Scrolling.ScrollHeight = Unit.Percentage(100);
adminGrid.ClientSettings.Resizing.AllowColumnResize = true;
adminGrid.PagerStyle.Mode = GridPagerMode.NextPrevNumericAndAdvanced;
adminGrid.GroupingSettings.CaseSensitive = false;
//Add columns to Grid
GridBoundColumn boundColumn;
boundColumn = new GridBoundColumn();
boundColumn.Display = false;
boundColumn.DataField = OrganizationListData.FIELD_ID;
boundColumn.HeaderText = OrganizationListData.FIELD_ID;
boundColumn.ShowFilterIcon = false;
adminGrid.MasterTableView.Columns.Add(boundColumn);
The columns and rows are all done in server code.
This all just so strange. The grid rows appear correctly and then a flash later shrinks to half a row. Resize and all works fine.
I have tried delayed multiple resize SetGridDiv calls, no luck.
I have tried setting the grid height to 100%, the panel windowPercent class sets the height to 100% already.
I have tried setting a row count.
The Grid samples seem to do nothing to get grids with height. They use class demo-container and no-bg which are not defined in the sample code.
This is a MAJOR product disaster, an important grid starting out as a half row. If this cannot be fixed I will be forced to find other tools.