views:

340

answers:

1

I would like to capture the "innerHTML of a asp:Table control from a button click. i.e. webforms page has an asp:Table control that is dynamically populated at run time. I need a quick/dirty print button to print the contents of the table. Ideally, I'd like to just have a simple way to grab the markup of the rendered table to squirt to a new generic non-displaying form that all it does is execute a Javascript print command on whatever markup it has on its page. Any ideas? Alternatives would be welcome too. Thanks!

A: 

I would suggest you use the @media print CSS media type to do this.

For example, say your site has a left hand column with an id of #leftNav. The following will hide that div when the use goes to Print the page:

<style type="text/css">

@media print
{
    #leftNav
    {
     display: none;
    }
}

</style>

In doing this, you can customize the look and feel of a printed page just like you would a standard browser page.

Jordan S. Jones