Skip to content

DevExpress-Examples/mvc-gridview-full-screen-mode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Grid View for ASP.NET MVC - How to display the Grid View in full screen mode (100% width and height)

This example demonstrates how to adjust the size of the Grid View extension to the size of the browser window.

Full screen grid

Overview

Follow the steps below to display the GridViewExtension in full screen mode.

1. Remove Margins

Set the body element's paddings and margins to zero.

body, html  {
    padding: 0;  
    margin: 0;  
}  

2. Add a Vertical Scroll Bar

Set the VerticalScrollBarMode property to Visible to show the vertical scrollbar.

@Html.DevExpress().GridView(settings => {
    settings.Name = "grid";
    settings.Width = System.Web.UI.WebControls.Unit.Percentage(100);
    // ...
    settings.Settings.VerticalScrollBarMode = ScrollBarMode.Visible;
}).Bind(Model).GetHtml()

3. Set the Control's Height

Handle the Grid View extension's Init and EndCallback client-side events and call the SetHeight method to adjust the Grid View's height during initialization and after each callback.

@Html.DevExpress().GridView(settings => {
    settings.Name = "grid";
    settings.ClientSideEvents.Init = "OnInit";
    settings.ClientSideEvents.EndCallback = "OnEndCallback";
    // ...
}).Bind(Model).GetHtml()
function OnInit(s, e) {
    AdjustSize();
    ASPxClientUtils.AttachEventToElement(window, "resize", function (evt) {
        AdjustSize();
    });
}
function OnEndCallback(s, e) {
    AdjustSize();
}
function AdjustSize() {
    var height = document.documentElement.clientHeight;
    grid.SetHeight(height);
}

Files to Review

Documentation

More Examples