Printing DataGrid

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is it possible to print the contents of a webform datagrid and if so how?

Thanks,

Dave
 
Hi,

no directly, remember that the datagrid is a server side control, no it
does not exist in the client.
There are some workaround though, I had a similar situation, what I did was
this:
1- Wrapped the datagrid in a <div> like this:
<div ID="TheGridDiv" Name="TheGridDiv">

2- the Print button open a new empty page with this code:
<script>
function DoMe()
{
document.all["TheDiv"].InnerHTML =
opener.document.all["TheGridDiv"].InnerHTML;
print();
close();
}
</script>
<body onLoad ="DoMe();">
<div name="TheDiv">


PLEASE note that I wrote the above code in the email, it may contains error
but the idea is there.

cheers,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top