Search code examples
asp.net-mvc-3webgrid

Does MVC3 WebGrid support horizontal scrollbars?


I have a record set that is quite wide (about 25-30 cols)...does MVC3 WebGrid support horizontal scrollbars (or can I house the grid in a html tag/control)?


Solution

  • Never realised about the WebGrid, so had to play with it to help on this one.

    Basically, if you put the webgrid inside a div with an overflow set, then it seems to work fine.

    I tested it on mine with the following code (I just shrank the test div to simulate small screen/many rows (was to lazy to create loads of col/properties, lol.

    <div class="test" style="overflow: scroll; width: 150px">
        <div style="width: 1000px">
            @grid.GetHtml()
        </div>
    </div>