Hi,
I am trying to print a listview from a web page. It is not a Windows forms listview. Even though the webpage contains many other controls, I am interested in printing only the listview with its items. Could you please let me know how to do this?
Thanks and Regards,
Mohan
Loading
Sam HobbsPosted Feb 25, 2010, 11:28 AM
Mohan MudaliarPosted Mar 1, 2010, 5:50 AM
Thank you. It worked for me.
Regards,
Mohan
Raaj KumarPosted Feb 25, 2010, 11:18 AM
Using javascript you can do this. Since it is easy to implement.
function CallPrint(strid)
{
var prtContent = document.getElementById(strid);
var WinPrint = window.open('', '', 'letf=0,top=0,width=1,height=1,toolbar=0,scrollbars=0,status=0');
WinPrint.document.write(prtContent.innerHTML);
WinPrint.document.close();
WinPrint.focus();
WinPrint.print();
WinPrint.close();
}
This will get the entire listview control and put it inside a new window with all the data This can be used for any control. And on a button click call the javascript.
Here i have a passed the div which holds the Listview control.
Hope this could help you.
Regards,
raaj