Adjusting the grid height

5 replies. Last post: November 9, 2011 3:07 AM by Yudi
Tags :
  • New Discussion
  • New Question
  • New Product Feedback

Hi, 

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 + the extras available (filter bar, group by box, etc).

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).

webGrid.Load += OnLoadGrid;
/// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void OnLoadGrid(object sender, EventArgs e)
        {
            int baseHeight = 81;
            int perRowHeight = 21;
            int gridHeight = baseHeight + webGrid.RootTable.Rows.Count * perRowHeight;
            webGrid.Height = Unit.Pixel(gridHeight);
            webGrid.RequiresUIRefresh = true; 
        }

 

Is there a way to programmatically resize the grid on every PostBack/FlyPostback?

All times are GMT -5. The time now is 7:19 PM.
Previous Next