Is it possible to adjust the size of the web grid if the user expands the size of the web page?
I would like to grow the web grid downwards if the user chooses to expand the web page to full screen.
The web grid is AJAX mode, with pages enabled due to the large data sets.
Indeed, finding exact object positions in browsers can be tricky.
If you are already using ASP.NET 3.5, you can try using the not very popular, but very helpful client-side method getLocation to get the coordinates of the grid element. Some information can be found here:
http://weblogs.asp.net/bleroy/archive/2008/01/29/getting-absolute-coordinates-from-a-dom-element.aspx
If you are still using ASP.NET 1.x / 2.x, you can try using the FindPos function proposed by the QuirksMode website (a very useful site on all things Javascript/DOM)
http://www.quirksmode.org/js/findpos.html
Hope this helps / provides additional clues.
Very helpful! It took me a while to track down the appropriate html object to determine the size of the browser canvas in order to caclulate the correct height:
Since I am using a MasterPage for my web forms, I had to enter an ID for the html element in the associated master page, then useing the document object, find this element and use this to get the clientHeight:
var grid = igtbl_getGridById(uwgName);
var htmlEl=document.all("FormViewMasterId");
var gHeight = htmlEl.clientHeight-100;
The 100 is there until I can figure out where the top of the grid element is.
grid.Element
But all the Top items I can find return 0 and this element is definitily not at the top of the page.
Any idea how I can determine the Top location of the grid on the page?
If you want to set just the height or width. dont want to use Resize CSOM function
If your grid Name is say 'mygrid'.
mygrid.MainGrid.style.height ="200px";
mygrid.MainGrid.style.width="200px";
This way you can set the height and width of grid Individually.
I believe this is possible using the UltraWebGrid client-side object model (CSOM) documented here:
http://help.infragistics.com/Help/NetAdvantage/NET/2008.1/CLR2.0/html/WebGrid_Object_CSOM.html
and the resize(width, height) function in particular. You can call it from window.resize event. For example:
window.onresize = function() { var grid = igtbl_getGridById("<%= UltraWebGrid1.ClientID %>"); grid.resize(50,50); }