This example demonstrates how to resize the ASPxGridView control based on the browser window size.
Update:
To keep the visual grid's size intact while adjusting it on the first load, wrap ASPxGridView with a hidden container and show it only after its full initialization and adjustment. For example:
Question Comments
Added By:
neuDev33 at:
5/16/2012 11:48:45 AM I'm copy + pasting this code, but the height does not increase to cover the parent control
Added By:
just wqq at:
9/18/2012 7:45:13 PM DevExpress.Web.ASPxGridView.v8.3 can do this
Added By:
Michelle Young at:
7/31/2013 7:46:42 AM Visual studio says the code behind method is obsolete and you should now use RegisterBaseScript instead.
Added By:
Yevgeniy Reznik at:
7/31/2013 8:45:41 PM Can you please update to the latest version of DevExpress?
Added By:
Honesto Manlig at:
5/28/2014 9:03:24 PM How can I have the columns to be of width they need to be. Except for the last column to be the only one that grows to fill the rest of the gridview. For example, if there's three columns, if first column contains text, it'll get as wide as it needs to so it does not wrap the text, then second column is a checkbox, so can always be same width, then the last column must get wide enough so that it fills the rest of the grid's width.
Added By:
Artem (DevExpress Support) at:
5/29/2014 12:01:42 AM Hello,
I've moved your question to a separate thread created on your behalf:
How to use the ASPxGridView control (with the enabled vertical scrollbar) in a Full Screen mode (100% browser Width and Height)Please refer to it for further correspondence.Added By:
Satarupa Brahma 1 at:
3/8/2016 10:37:29 AM It is important to note that the ClientInstanceName needs to be set so that the java script can find the control that needs to be resized. I struggled with this for several hours before I found the key.Added By:
Jonathan Kent at:
9/7/2017 5:05:55 AM When trying to implement this resolution using Razor it worked fine but I experienced a javascript error when my gridview was editable when clicking on add or update. To resolve the issue I removed all javascript and simply added this line to my gridview implentation;
settings.ClientSideEvents.Init = "function OnInit(s, e) {myGridViewName.SetHeight(Math.max(0, document.documentElement.clientHeight));}";
Added By:
Larry (DevExpress Support) at:
9/7/2017 5:28:31 AM Hello Jonathan,
Thank you for providing your solution. I believe it may be helpful to other users.
Added By:
Patrik Johansson _ at:
11/18/2017 9:05:40 AM This ticket claims to set widht and height but I can see no code that actually sets the width? Also, I still find it strange that such an obvious feature as to resize the popup window for a very mature control like the ASPxGridView should require this much manual coding even in 2017. Added By:
Vova (DevExpress Support) at:
11/20/2017 1:44:43 AM Hello Patrik,
The Width property is specified in this example. Since it's set to "100%", ASPxGridView occupy all the available space inside its parent container.
Regards,
VovaAdded By:
Suman Rayabharapu 1 at:
3/16/2018 7:59:25 AM How can we implement this using DevExpress MVC gridview control. The idea is keep the paging, add the scroll bar but the height and width of the grid should be automatic based on the availability.
Because we will be using the same URL on a tablet where users can work in portrait or landscape mode.
We are using 17.2.6 version currently using VS 2015. Added By:
Lanette (DevExpress Support) at:
3/16/2018 10:32:00 AM Hello,
I've created a separate ticket on your behalf (T616870: GridView - How to implement a grid with 100% width and height) regarding this task for MVC. It has been placed in our processing queue and will be answered shortly.