Intersoft WebGrid Documentation
How-to: Set the column's best fit
See Also Send comments on this topic.

Glossary Item Box

Use ResizeBestFit function to automatic resize WebGrid column to best fit based on text in it via client side.

This topic will show you how to automatic resize WebGrid's column.

To resize WebGrid column's best fit

  1. Drag WebGrid instance into the WebForm.
  2. Add a client side function on your code.
  3. You can resize best fit grid's column by simply using:

  4. JavaScript Copy Code
    function Button1_onclick() 
    {
    var grid = ISGetObject("WebGrid1");
    var prodColumn = grid.RootTable.Columns.GetNamedItem("ProductName");
    prodColumn.ResizeBestFit();
    }

See Also

©2012 Intersoft Solutions Corp. All Rights Reserved.