Infragistics Home

Infragistics Forums

Infragistics community online discussions.
Welcome to Infragistics Forums Sign in | FAQ
in Search

change height of ultrawebgrid to the height of the browser

Last post 07-08-2008 14:45 by asairam. 8 replies.
Page 1 of 1 (9 items)
Sort Posts: Previous Next
  • 07-02-2008 16:50

    • hawi1978
    • Top 500 Contributor
    • Joined on 07-02-2008
    • Points 238

    change height of ultrawebgrid to the height of the browser

    This is the code i used

       var gridID;

    function UltraWebGrid1_InitializeLayoutHandler(gridName){

        gridID = gridName;

     

        setGridHeight();

    }

    function setGridHeight(){    var myHeight = getWindowHeight() - 100;

     

        var grid = igtbl_getGridById(gridID);

        grid.resize(750, myHeight);

    }

    function getWindowHeight() {

        var myWidth = 0, myHeight = 0;

        if( typeof( window.innerWidth ) == 'number' ) {

            //Non-IE

           myWidth = window.innerWidth;

           myHeight = window.innerHeight;

        }
    else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {

            //IE 6+ in 'standards compliant mode'

            myWidth = document.documentElement.clientWidth;

            myHeight = document.documentElement.clientHeight;

        }
    else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {

           //IE 4 compatible

           myWidth = document.body.clientWidth;

           myHeight = document.body.clientHeight;

        }

        return myHeight;

    }

     

    This seems to work for grid containing few rows, but if the number of rows exceeds even 20, the height of the grid turns out to be greater than the height of the browser.

    Why isn't this working and is there any other way for me to do what i need? Any help will be appreciated.

    Thank you,

    Filed under:
    • Post Points: 20
  • 07-02-2008 17:41 In reply to

    Re: change height of ultrawebgrid to the height of the browser

    This may help - we found the doctype created by VS 2005 by default was messing up our grids.  We use this one instead from VS 2003:

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" > 

    Hope this helps. 

    • Post Points: 20
  • 07-03-2008 3:12 In reply to

    Re: change height of ultrawebgrid to the height of the browser

    The following forum posts provides some additional information  and sample code that can be useful in your case as well

    http://forums.infragistics.com/forums/p/9224/36093.aspx#36093

    This may also be related and helpful:

    http://forums.infragistics.com/forums/p/2726/16560.aspx#16560 

    Hope this help. 

    Best Regards,
    Rumen Stankov (MCSD.NET)
    The Infragistics ASP.NET Team
    • Post Points: 20
  • 07-03-2008 8:32 In reply to

    • hawi1978
    • Top 500 Contributor
    • Joined on 07-02-2008
    • Points 238

    Re: change height of ultrawebgrid to the height of the browser

    Thanks for the links.I used those forums to get an idea of how to resize the grid size depending on the window size.

    My problem is that it doesn't seem to work for grids containing a lot of rows (10 or more). Why is that? I'm unable to fix it.

    Please help!

    • Post Points: 20
  • 07-03-2008 8:48 In reply to

    Re: change height of ultrawebgrid to the height of the browser

    Well, this is a tricky topic and really depends on a lot of things, for example browser, DOCTYPE, etc, etc. I can suggest a few things:

    1) The CSOM resize() method documented here:

    http://help.infragistics.com/Help/NetAdvantage/NET/2008.2/CLR2.0/html/WebGrid_Object_CSOM.html

    2) Following this thread and using the resizeGrid() method suggested by "lallebob"

     http://forums.infragistics.com/forums/p/4326/20947.aspx#20947

    Best Regards,
    Rumen Stankov (MCSD.NET)
    The Infragistics ASP.NET Team
    • Post Points: 20
  • 07-03-2008 10:37 In reply to

    • hawi1978
    • Top 500 Contributor
    • Joined on 07-02-2008
    • Points 238

    Re: change height of ultrawebgrid to the height of the browser

    If you look at my inital post, i'm using the resize() method.

    It resizes the grid if the number of rows is less but if the number of rows is a lot more i.e. if the grid gets longer than the window's height, it doesn't seem to set a fixed height that corresponds to the height of the window.

    Anyone?

    • Post Points: 20
  • 07-03-2008 11:54 In reply to

    • asairam
    • Top 150 Contributor
    • Joined on 01-25-2008
    • Points 408

    Re: change height of ultrawebgrid to the height of the browser

    Answer

    Can you try following:

    Enclose the grid in a div tag and set the height of div tag dynamically based on window size.

    Set the following properties for the grid:

    <DisplayLayout TableLayout="Auto" ScrollBar="auto"...>

    <FrameStyle Height="100%"../>

    < /DisplayLayout>

    I think this should work.

    • Post Points: 20
  • 07-07-2008 17:04 In reply to

    • hawi1978
    • Top 500 Contributor
    • Joined on 07-02-2008
    • Points 238

    Re: change height of ultrawebgrid to the height of the browser

    Thank you Asairam, that worked!!

    Filed under:
    • Post Points: 38
  • 07-08-2008 14:45 In reply to

    • asairam
    • Top 150 Contributor
    • Joined on 01-25-2008
    • Points 408

    Re: change height of ultrawebgrid to the height of the browser

    Good to hear that.

    Can you use the "Answer" button and the star ratings to mark your problem as solved?

     

    • Post Points: 5
Page 1 of 1 (9 items)
Powered by Community Server (Commercial Edition), by Telligent Systems