This is a migrated thread and some comments may be shown as answers.

Grid Horizontal Scrolling, auto adjust height

1 Answer 211 Views
Grid
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 1
David asked on 23 Feb 2012, 12:55 PM
We have been trying to get the RadGrid to allow horizontal scrolling (if the width of the columns exceeds our grid width), but make the height auto adjust to the number of rows that are contained within it.

We are generating the Grid dynamically like so...

var telerikGrid = new RadGrid
{
    ID = "RadGrid1",
    DataSource = request.dataTable,
    AllowSorting = true,
    AllowPaging = true,
    Width = Unit.Pixel(980),
    AutoGenerateColumns = true,
    GridLines = GridLines.Both,
    Skin = ddlStyle.SelectedValue ?? "Black"
};
//telerikGrid.MasterTableView.TableLayout = GridTableLayout.Fixed;
//Scrolling
telerikGrid.ClientSettings.Scrolling.AllowScroll = true;
//telerikGrid.ClientSettings.Scrolling.SaveScrollPosition = true;
telerikGrid.ClientSettings.Scrolling.UseStaticHeaders = true;
telerikGrid.ClientSettings.Selecting.AllowRowSelect = true;
telerikGrid.ClientSettings.Scrolling.FrozenColumnsCount = 1;
//telerikGrid.ClientSettings.Scrolling.ScrollHeight = Unit.Percentage(100);
telerikGrid.MasterTableView.VirtualItemCount = request.dataTable.Rows.Count;
//telerikGrid.ClientSettings.Scrolling.ScrollHeight = Unit.Percentage()
//Resizing
telerikGrid.ClientSettings.Resizing.AllowColumnResize = true;
//Reordering
telerikGrid.ClientSettings.AllowColumnsReorder = true;
//Export
telerikGrid.MasterTableView.CommandItemSettings.ShowExportToExcelButton = true;
telerikGrid.MasterTableView.Visible = true;
telerikGrid.MasterTableView.CommandItemDisplay = GridCommandItemDisplay.Top;
 
telerikGrid.PagerStyle.Mode = GridPagerMode.NextPrevAndNumeric;

If we set the AllowScroll  property to false, then the vertical scrolling acts appropriately, but we then don't get the horizontal scrolling that is required.

1 Answer, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 24 Feb 2012, 02:28 PM
Hello David,

ou can try setting ScrollHeight property to empty string as shown below and see if it helps to achieve your goal:
telerikGrid.ClientSettings.Scrolling.ScrollHeight = "";

All the best,
Pavlina
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Grid
Asked by
David
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Share this question
or