输出PDF文档到ASP.NET页面
protected
void Page_Load(object sender, EventArgs e)
{
try
{
//query the pdf path
string pdfna =
this.Request.QueryString["pdf"];
if (pdfna == null)
throw new Exception("This
page can not be accessed directly");
string pdf = "Reports\\" +
pdfna;
pdf = Server.MapPath(pdf);
//read all bytes
if (File.Exists(pdf) == false)
throw new Exception("This
report is not created");
FileStream fs = File.Open(pdf,
FileMode.Open);
byte[] buffer = new
byte[fs.Length];
fs.Read(buffer, 0,
buffer.Length);
fs.Close();
//write to response
Response.ContentType =
"application/pdf";
Response.AddHeader(
相关文档:
一.后台调用前台
1.Page.ClientScript.RegisterStartupScript(type,"",script);
例:
string script = string.Format("<script>alert('Wrong');</script>");
Page.ClientScript.RegisterStartupScript(GetType(), "Load", script);
2.对象.Attributes.Add("事件","script")
例:
e.Row.Attributes.Add("on ......
在asp.net里使用com组件导出excel后总是会有一个EXCEL.EXE进程存在,占据着30多M的内存,研究了好久试了网上的很多办法都没有解决。今天心情比较放松,接着从网上搜了一下,看到一篇帖子如下:
在DOT NET中调用Excel后,Excel进程的并未终止问题的解决办法 收藏
在DOT NET中调用Excel后,Excel进程的并未终止问题 ......
问题提出:
在应用程序中经常需要查询数据。当查询结果数据量比较大的时候,检索结果、界面显示都需要花费大量的时间。为了避免这个问题,应该每次只检索部分数据,也就是使用常见的分页方式来处理。分页的问题在asp.net中好像非常简单,只要在GridView中启用分页就可以了。启用分页后,GridView关联数据源控件,依旧会加载 ......
1.添加js函数
function TextBoxEntered(buttton) {
if (event.which || event.keyCode) {
if ((event.which == 13) || (event.keyCode == 13)) {
document.getElementById(button).click();
return false;
}
......