ASP.NET打印功能:打印asp.net控件与它的风格 [英] ASP.NET Print Function: to print asp.net controls with its style

查看:176
本文介绍了ASP.NET打印功能:打印asp.net控件与它的风格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发一个Intranet Web应用程序。我想开发我可以用它来打印的特定部分从网页简单的打印功能,我可以用它来打印的GridView或ListView与它的风格。我在网上搜索一下,大部分是我发现的是,打印GridView控件,例如,与它的风格javascript函数。

I am developing an intranet web application. And I want to develop simple print function that I can use it to print a specific part from the web page and I can use it to print GridView or ListView with its style. I am searching about it in the web and most of what I found is javascript function that print the GridView, for example, with its style.

比如说,我用这个打印功能是基于C#类和它的作品,但它打印像GridView中的控件没有它的风格,我有它的网页。那么,有没有打印任何简单的功能?

For instance, I used this Print Function that is based in C# class and it works but it prints the controls like GridView without its style that I have it in the webpage. So is there any simple function for printing?

推荐答案

但问题是打印页面中你不会呈现的CSS

Problem is your not render css during printing the page

根据您的链接引用只需添加样式表的URL在 PrintWebControl 函数code

according your link reference just add your stylesheet url in PrintWebControl function code

string strHTML = stringWrite.ToString();
HttpContext.Current.Response.Clear();
HttpContext.Current.Response.Write(@"<link href='/Styles/Site.css' rel='stylesheet' type='text/css' />");
HttpContext.Current.Response.Write(strHTML);

啤酒花的帮助

这篇关于ASP.NET打印功能:打印asp.net控件与它的风格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆