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
130
Determining size of webgrid at the server
posted

I have figured out how to determine the size of a webgrid at the client-side but can't seem to figure out how to get that information at the server. I am not setting the width or height of the grid but letting it figure it out on it's own (as my number of columns are dynamic).

On the client side I take the width of the frame element that surrounds the grid:

function grdData_InitializeLayoutHandler(gridName){
   var oGrid = igtbl_getGridById(gridName);
   var intWidth = new Number(oGrid.Element.style.width.replace('px',''));
   autofitIframe('iframeReport',intWidth);
}

(Note that I needed to know the actual width on the client side so I could resize the calling parent frame accordingly.)

Can anyone point me in the right direction on the server side? I need to pass the grid width into a function that spits my webpage out to a pdf as an image (using ABCpdf from WebSupergoo) & it would help if I knew the width of grid so I can choose appropriate paper sizes... Note that the size of my webpage will always stretch out to the size of the grid.

Please help! Thanks!

 

Tina

Parents
  • 45049
    Verified Answer
    posted

    There's no direct way to determine what size the WebGrid is on the server.  The server doesn't know what settings are on the client machine, including font settings that can be configured on the browser, and some of these settings can affect the resulting height.

    The closest solution I've seen is to calculate the width and height client-side (similar to the code you already have), store the results in a hidden field, and use those values on the server.  Note that you may also need to retrieve other information, such as font settings, for the width and height to be meaningful.

Reply Children