Monday, January 30, 2012

RadGrid - AutoFit columns in a grid


Call the following function on page load to force the RadGrid to auto size the columns:


function pageLoad() {
var grid = $find("RadGrid1");
var columns = grid.get_masterTableView().get_columns();
for (var i = 0; i < columns.length; i++) {
columns[i].resizeToFit();
}
}