Coder Social home page Coder Social logo

devexpress-examples / mvc-gridview-full-screen-mode Goto Github PK

View Code? Open in Web Editor NEW
1.0 55.0 1.0 471 KB

Adjust the size of the Grid View extension to the size of the browser window.

License: Other

C# 26.06% HTML 17.78% ASP.NET 1.22% Visual Basic .NET 54.94%
dotnet mvc-gridview asp-net-mvc

mvc-gridview-full-screen-mode's Introduction

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

mvc-gridview-full-screen-mode's People

Contributors

devexpressexamplebot avatar svetlanamikheeva avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

codekarno

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.