﻿<?xml version="1.0" encoding="utf-8"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:media="http://search.yahoo.com/mrss/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0"><channel><title>Intersoft Community - WebGrid Enterprise - Adjusting the grid height</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Adjusting-the-grid-height/</link><description /><generator>http://www.intersoftsolutions.com</generator><language>en</language><copyright>Copyright 2002 - 2015 Intersoft Solutions Corp. All rights reserved.</copyright><ttl>60</ttl><item><title>Adjusting the grid height</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Adjusting-the-grid-height/</link><pubDate>Wed, 09 Nov 2011 03:07:03 GMT</pubDate><dc:creator>yudi</dc:creator><category>WebGrid</category><description>&lt;p&gt;&lt;span style="font-family: 'segoe ui','sans-serif'; color: #1f497d; font-size: 9pt;"&gt;Please try to set the grid’s width in OnAfterResponse client-side event.&lt;br /&gt;Hope this helps.&lt;/span&gt;&lt;/p&gt;</description></item><item><title>Adjusting the grid height</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Adjusting-the-grid-height/</link><pubDate>Tue, 08 Nov 2011 11:21:03 GMT</pubDate><dc:creator>mpodbielski</dc:creator><category>WebGrid</category><description>&lt;p&gt;What ClientSide function I can use to change WebGrid Width ?&lt;/p&gt;&lt;p&gt;Best Regards,&lt;/p&gt;
&lt;p&gt;Michal &lt;/p&gt;</description></item><item><title>Adjusting the grid height</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Adjusting-the-grid-height/</link><pubDate>Thu, 22 Apr 2010 11:19:02 GMT</pubDate><dc:creator>handy@intersoftpt.com</dc:creator><category>WebGrid</category><description>&lt;p&gt;            If you don't want to show scrollbar at WebGrid right position, you can use &lt;strong&gt;&lt;em&gt;
                grid.HidePadColumn = false;&lt;/em&gt;&lt;/strong&gt; (javascript).&lt;/p&gt;
        
&lt;p&gt;
            Also, I don't quite understand why do you need refresh the grid after added a new
            row in WebGrid. Refresh() would not have any effect to the layout. RefreshAll()
            should be the one for WebGrid structure.&lt;/p&gt;
        
&lt;p&gt;
            As far I know, the scrollbar would be appeared if the records in the WebGrid content
            are not fit with WebGrid height. So, perhaps you would need to SetHeight WebGrid
            (as Yudhiy suggestion).&lt;/p&gt;
        
&lt;p&gt;
            It depends on the container and WebGrid height/structure itself.&lt;/p&gt;
        
&lt;p&gt;
            WebGrid would automatically resize for the best fit/ layout size.&lt;/p&gt;
        
&lt;p&gt;
            Normally, WebGrid called wgDoResize() to resize function itself.
        &lt;/p&gt;
        
&lt;p&gt;
            e.g if you resize the browser, WebGrid should be resized itself.&lt;/p&gt;
        
&lt;p&gt;
            If WebGrid does not resize itself after FlyPostBack request, you can try to call
            this method OnAfterResponse client side event.&lt;/p&gt;
        
&lt;p&gt;
            It would be more helpful if you can provide a simple runable sample. By following
            your WebGrid settings and structure, we can discuss the best approach for your scenario.
        &lt;/p&gt;
        
&lt;p&gt;
            Regards,&lt;br /&gt;
            Handy&lt;/p&gt;</description></item><item><title>Adjusting the grid height</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Adjusting-the-grid-height/</link><pubDate>Wed, 21 Apr 2010 16:55:47 GMT</pubDate><dc:creator>Gmontes</dc:creator><category>WebGrid</category><description>&lt;p&gt;Hi Yudi,&lt;/p&gt;&lt;p&gt;Thanks for you reply, it's still not what I need (and I see autoheight still has issues with the XHTML Doctype so that's not an option). &lt;/p&gt;
&lt;p&gt;I'm adding entries to my DataSource and refreshing the grid via a javascript Refresh()... problem is, your approach resizes the container, it's not really refitting the content in the grid to ocupy the new given height. Please see the attachments to see whatI'm talking about.... in ResizeGrid2 you can see the grid grows past the original position of the status bar but it displays as an empty canvas.&lt;/p&gt;
&lt;p&gt;I went with another solution, instead of having a javascript function do the refresh, have it fire a customrequest.... then catch that onInitializePostback and there resize-refresh (with this effectively using two FlyPostBacks to refresh), but the same thing happens:&lt;/p&gt;&lt;pre&gt;        protected void ResizeAndRefresh(object sender, ISNet.WebUI.WebGrid.PostbackEventArgs e)
        {
            if (e.Action == ISNet.WebUI.WebGrid.PostBackAction.Custom)
            {
                webGrid.ClientAction.InvokeScript(
                    string.Format("Resize({0});", GetNewGridHeight())
                    );
                webGrid.ClientAction.Refresh();
            }
        }&lt;/pre&gt;
&lt;br /&gt;
&lt;p&gt; Is there any way to resize (and re-fit) the grid?&lt;/p&gt;
&lt;p&gt;Edit:
Ok, so much for the attach file... It's not working.&lt;/p&gt;&lt;br /&gt;&lt;img src="http://img717.imageshack.us/img717/3478/resizegrid.jpg" /&gt;&lt;br /&gt;&lt;img src="http://img535.imageshack.us/img535/8114/resizegrid2.jpg" /&gt;</description></item><item><title>Adjusting the grid height</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Adjusting-the-grid-height/</link><pubDate>Tue, 20 Apr 2010 22:52:33 GMT</pubDate><dc:creator>yudi</dc:creator><category>WebGrid</category><description>&lt;p&gt;&lt;span style="font-family: 'segoe ui','sans-serif'; color: #1f497d; font-size: 9pt"&gt;Please try to resize grid height in &lt;strong&gt;OnLoad server-side event&lt;/strong&gt;. Due to WebGrid’s documentation that explains about event sequence of WebGrid’s server-side events, this event will be executed both during ‘not’ on the FlyPostBack and on the FlyPostBack.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: 'segoe ui','sans-serif'; color: #1f497d; font-size: 9pt"&gt;In order to determine whether current event is FlyPostBack or not, &lt;strong&gt;IsPostBack&lt;/strong&gt; flag can be utilized. IsPostBack’s value indicates whether the page is being loaded in response to client postback (FlyPostBack) or if it is being loaded and accessed for the first time.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: 'segoe ui','sans-serif'; color: #1f497d; font-size: 9pt"&gt;If IsPostBack is true (on the FlyPostBack), use InvokeScript method to call client-side script (javascript function) that will resize WebGrid’s height. In client-side, simply call ‘&lt;strong&gt;SetHeight(&lt;em&gt;height parameter in pixel unit&lt;/em&gt;)&lt;/strong&gt;’ method to resize WebGrid’s height.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: 'segoe ui','sans-serif'; color: #1f497d; font-size: 9pt"&gt;If IsPostBack is false (not on the FlyPostBack), then set grid height programmatically in code behind. Below is the snippet code that I use on my test page to test your scenario.&lt;/span&gt;&lt;/p&gt;&lt;pre&gt;protected void WebGrid1_Load(object sender, EventArgs e)
{
    if (IsPostBack)
        WebGrid1.ClientAction.InvokeScript("ResizeHeight();");
    else
        WebGrid1.Height = Unit.Pixel(600);
}&lt;/pre&gt;&lt;pre&gt;&amp;lt;script type="text/javascript"&amp;gt;
    &amp;lt;!--
    function ResizeHeight() {
        var WebGrid1 = ISGetObject("WebGrid1");

        WebGrid1.SetHeight(400);

        return true;
    }
    --&amp;gt;
&amp;lt;/script&amp;gt;&lt;/pre&gt;
&lt;p&gt;&lt;span style="font-family: 'segoe ui','sans-serif'; color: #1f497d; font-size: 9pt"&gt;Hope this helps.&lt;/span&gt;&lt;/p&gt;</description></item><item><title>Adjusting the grid height</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Adjusting-the-grid-height/</link><pubDate>Tue, 20 Apr 2010 17:50:46 GMT</pubDate><dc:creator>Gmontes</dc:creator><category>WebGrid</category><description>&lt;p&gt;Hi, &lt;/p&gt;
&lt;p&gt;I'm trying to resize the grid to fit all the rows without scrolling... this seems to work for the initial load as I'm doing this onPreRender (all I'm doing is determinen the gridHeight based on webGrid.RootTable.Rows.Count &amp;#43; the extras available (filter bar, group by box, etc).&lt;/p&gt;
&lt;p&gt;My problem is that during a FlyPostBack I can't resize the grid (as some operations add records and just call Grid.ClientActions.Refresh()). I'm using the GridLoad event (as I should have available the rowcount in there).&lt;/p&gt;
&lt;p /&gt;&lt;pre&gt;webGrid.Load &amp;#43;= OnLoadGrid;
/// &amp;lt;summary&amp;gt;
        /// 
        /// &amp;lt;/summary&amp;gt;
        /// &amp;lt;param name="sender"&amp;gt;&amp;lt;/param&amp;gt;
        /// &amp;lt;param name="e"&amp;gt;&amp;lt;/param&amp;gt;
        protected void OnLoadGrid(object sender, EventArgs e)
        {
            int baseHeight = 81;
            int perRowHeight = 21;
            int gridHeight = baseHeight &amp;#43; webGrid.RootTable.Rows.Count * perRowHeight;
            webGrid.Height = Unit.Pixel(gridHeight);
            webGrid.RequiresUIRefresh = true; 
        }&lt;/pre&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p /&gt;
&lt;p&gt;Is there a way to programmatically resize the grid on every PostBack/FlyPostback?&lt;/p&gt;</description></item></channel></rss>