Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
265
How to change the height of the webgrid dynamically
posted

when I try to do this

in javascript


document.getElementById(<%=grid1.ClientID%>).height =  299 + px;

 

It does not change its height. Do I need to set the height of the frame too.

I have something like

<FrameStyle>

</FrameStyle> in the displaylayout area.

I am new   using this grid. Can you please help me. if I need to set the frame height too, can you please tell me how to set it.

 

Thanks

 

 

  • 45049
    Suggested Answer
    posted

    Using document.getElementById() gets a reference to a single HTML element.  WebGrid contains multiple HTML elements, in addition to other JavaScript objects.  You should use the grid's Client-Side Object Model (CSOM) to maniuplate it whenever possible.

    Taking a look at the CSOM Overview of WebGrid (link leads to the article in the online help documentation of NetAdvantage for .NET 2009 Volume 1), and looking at the "WebGrid Object" link, I see that there is a "resize()" function available.  So, using the code you provided as a starting point, test the following instead:

    var grid = igtbl_getGridById(<%=grid1.ClientID%>);
    grid.resize(desiredwidth, 299+px);