how to use print option in asp.net

Posted by Skaftabali under ASP.NET on 11/8/2010 | Points: 10 | Views : 4573 | Status : [Member] | Replies : 5
Hi,

I have one webform.In this webform i use one gridview and print button.
i retrieve data from webservice to gridview.
I want print those data.How to use this one pls guide me.




Responses

Posted by: Vuyiswamb on: 11/8/2010 [Member] [MVP] [Administrator] NotApplicable | Points: 25

Up
0
Down
if its a third party grid like Telerik or infragistics you could import it to pdf or Excell and print it or you can disable paging and use the javascript Window.Print function to print, but it wont come out nice , but what is not nice to me might be satisfactory to you.

Thank you for posting at Dotnetfunda

Vuyiswa Maseko

Thank you for posting at Dotnetfunda
[Administrator]

Skaftabali, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: T.saravanan on: 11/8/2010 [Member] [MVP] Silver | Points: 25
Posted by: Lalji_mer on: 11/9/2010 [Member] Bronze | Points: 25

Up
0
Down
hi,

please check this link

http://www.dotnetcurry.com/ShowArticle.aspx?ID=92&AspxAutoDetectCookieSupport=1

LP MER

Skaftabali, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Prabhakar on: 1/31/2011 [Member] [MVP] Starter | Points: 25

Up
0
Down
Hi Skaftabali

u want to print ur grid .so u add this script on print button

Button5.Attributes["onclick"] = "javascript:CallPrint('divPrint');";

and script in <HEAD> Section
<script type="text/javascript" >

function CallPrint(strid)
{
var prtContent = document.getElementById(strid);
var WinPrint = window.open('print.htm','PrintWindow','letf=0,top=0,width=800%,height=600,toolbar=1,scrollbars=1,status=1');
WinPrint.document.write(prtContent.innerHTML);
WinPrint.document.close();
WinPrint.focus();
WinPrint.print();
WinPrint.close();
}

</script>


Best Regard's
Prabhakar

Skaftabali, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Karthikanbarasan on: 1/31/2011 [Member] [Moderator] [Microsoft_MVP] [MVP] Silver | Points: 25

Up
0
Down
HI,

Chcek this article.,... its hows how to make use of printing along with the grid view paging as well..

http://www.codeproject.com/KB/custom-controls/GridViewPrinting.aspx

Thanks
Karthik
www.f5Debug.net

Skaftabali, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response