Hello,
I have a Radgrid with many columns, and without paging.
My users needs to (and can) scroll horizontally to read all the fields. But only by using the horizontal scrolling at the bottom of the grid, which is not convenient when the Grid has 100 rows or more. (If you want to read the first row, you need to scroll down the page, scroll right the grid, scroll up the page again).
I tried to use the ScrollHeight attribute but nothing happens. I also tried to add a height to my RadGrid, the grid itself respect the height but the rows don't (and overflow on the grids below).
I create my grid from the code behind so here is the code where it happens.
Can you help me ?
Thank you !
RadGrid grid =
new
RadGrid();
grid.ID = gridID;
grid.DataSourceID = dataSourceID;
grid.AllowMultiRowSelection =
true
;
grid.AllowPaging =
false
;
grid.ColumnCreated += Grid_ColumnCreated;
grid.BatchEditCommand += Grid_BatchEditCommand;
grid.AllowAutomaticUpdates =
true
;
grid.AllowAutomaticDeletes =
true
;
grid.AllowAutomaticInserts =
false
;
grid.AutoGenerateColumns =
true
;
//grid.Height = Unit.Pixel(300);
/* Client Settings */
grid.ClientSettings.Selecting.AllowRowSelect =
true
;
grid.ClientSettings.Selecting.UseClientSelectColumnOnly =
true
;
grid.ClientSettings.Scrolling.AllowScroll =
true
;
grid.ClientSettings.Scrolling.UseStaticHeaders =
false
;
grid.ClientSettings.Scrolling.ScrollHeight = Unit.Pixel(200);
grid.ClientSettings.ClientEvents.OnGridCreated =
"SetupButtons"
;
grid.ClientSettings.ClientEvents.OnKeyPress =
"GridKeyPress"
;
grid.ClientSettings.ClientEvents.OnCommand =
"OnGridCommand"
;
/* HeaderStyle */
grid.HeaderStyle.HorizontalAlign = HorizontalAlign.Center;
grid.HeaderStyle.BorderWidth = 1;
/* MasterTableView */
grid.MasterTableView.CommandItemDisplay = GridCommandItemDisplay.Top;
grid.MasterTableView.TableLayout = GridTableLayout.Fixed;
grid.MasterTableView.DataKeyNames =
new
string
[] { dataKey };
grid.MasterTableView.EditMode = GridEditMode.Batch;
grid.MasterTableView.BatchEditingSettings.EditType = GridBatchEditingType.Cell;
/* CommandItemSettings */
grid.MasterTableView.CommandItemSettings.ShowAddNewRecordButton =
false
;
grid.MasterTableView.CommandItemSettings.ShowRefreshButton =
true
;
grid.MasterTableView.CommandItemSettings.ShowCancelChangesButton =
true
;
grid.MasterTableView.CommandItemSettings.ShowSaveChangesButton =
true
;
/* Actions Columns */
GridClientSelectColumn selectColumn =
new
GridClientSelectColumn();
selectColumn.UniqueName =
"ClientSelectColumn"
;
selectColumn.HeaderStyle.Width = Unit.Pixel(50);
grid.Columns.Add(selectColumn);
GridClientDeleteColumn deleteColumn =
new
GridClientDeleteColumn();
deleteColumn.UniqueName =
"ClientDeleteColumn"
;
deleteColumn.HeaderStyle.Width = Unit.Pixel(50);
grid.Columns.Add(deleteColumn);
/* ADDING EVERYTHING ON THE PAGE */
Grids.Controls.Add(info);
//info is a RadLabel
Grids.Controls.Add(grid);
RadAjaxManager1.AjaxSettings.AddAjaxSetting(grid, info, RadAjaxLoadingPanel);
RadAjaxManager1.AjaxSettings.AddAjaxSetting(grid, grid, RadAjaxLoadingPanel);
protected
void
Grid_ColumnCreated(
object
sender, Telerik.Web.UI.GridColumnCreatedEventArgs e)
{
if
(e.Column
is
GridBoundColumn)
{
GridBoundColumn column = (GridBoundColumn)e.Column;
if
(isHidden)
{
column.Display =
false
;
column.ReadOnly =
true
;
}
else
{
if
(isReadOnly)
{
column.ReadOnly =
true
;
}
//Change column header
column.HeaderText = text;
column.HeaderStyle.Width = Unit.Pixel(size);
column.HeaderTooltip = tooltip;
}
}
}