Hi,
It might be easier to do with JavaScript. You would first open a new window and then call document.write to output on that window based on Grid data. It will be something like this:
Code: JavaScript
var grid = eo_GetObject("Grid1");
//Currently client side Grid object does not provide any method
//to retrieve column count. So it is hard coded here. You can also
//use <%= %> syntax to dynamically render the value here
var column_count = 3;
var wnd = window.open("", "print");
var doc = wnd.document;
doc.open();
//Here we simply loop through each item for demonstration
//purpose. You will most likely need to add some formatting
//HTML (for example, open table tag) for rendering each row
for (var i = 0; i < grid.getItemCount(); i++)
{
var item = grid.getItem(i);
//Loop through each cell
for (var j = 0; j < column_count; j++)
{
var cell = item.getCell(j);
//We only write out the cell value here. You will need to change
//this to include whatever style information you wish to have
doc.write(cell.getValue());
}
}
doc.close();
You can modify this code to include other elements, for example, a page header or other page contents to fit your need. The code should correctly handle sorting. But it will not handle column re-ordering because the index passed to getCell is the original column index. It is possible for you to build a map between a column's original index and current index (index after being moved) by first call Grid.getColumn method with an index value (the current index), then call the returned GridColumn objects getOriginalIndex to find out the original index for that index.
Hope this helps.
Thanks!