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.
Follow the steps below to display the GridViewExtension in full screen mode.
Set the body
element's paddings and margins to zero.
body, html {
padding: 0;
margin: 0;
}
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()
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);
}