How do I get the print of a .aspx page with all css applied(retained) to the page ?

Posted by Mahe under C# on 7/22/2013 | Points: 10 | Views : 1288 | Status : [Member] | Replies : 2
Hi,

How do I get the print of a .aspx page with all css applied(retained) to the page ? using C# asp.net

Regards,
Mahe




Responses

Posted by: aswinialuri-19361 on: 7/22/2013 [Member] Starter | Points: 25

Up
0
Down
hi ,
try this
<asp:Button ID="btnprint" runat="server" Text="Print"
OnClientClick="window.print();" />

Mark as Answer if it helps you
Thanks&Regards
Aswini Aluri

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

Posted by: Prabhukiran345 on: 7/24/2013 [Member] Starter | Points: 25

Up
0
Down
Hi,

<asp:Button ID="printButton" runat="server" Text="Print" OnClientClick="javascript:window.print();" /> ...

Or you can do in this manner:

protected void printButton_Click(object sender, EventArgs e)
{
printButton.Attributes.Add("onclick", "return printing()");
}


and the javascript printing() method is sipmle like this:


function printing()
{
window.print();


}
Mark as Answer If Helpful

Thanks,
Prabhu Kiran B

Thanks,
Prabhu Kiran Bommareddy

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

Login to post response