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
- Drag WebGrid instance into the WebForm.
- Add a client side function on your code.
- You can resize best fit grid's column by simply using:
-
JavaScript Copy Code function Button1_onclick()
{
var grid = ISGetObject("WebGrid1");
var prodColumn = grid.RootTable.Columns.GetNamedItem("ProductName");
prodColumn.ResizeBestFit();
}
Other Resources
Walkthrough Topics
How-to Topics