Binarywrite方法填充整个页面 [英] Binarywrite method fills the whole page

查看:79
本文介绍了Binarywrite方法填充整个页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在检索存储在sql中的二进制文件,并在弹出页面上显示它没有问题。但是我希望在同一页面上有一个按钮以便进一步处理。当显示任何类型的文件,pdf或图像时,页面上的按钮会消失。

那么如何保持按钮可见并正常运行?



我的代码如下:

I am retrieving binary file stored in sql and displaying it on a popup page without problem. But I want to have a button on the same page for further processing. The button on the page disappears when displaying any sort of file, pdf or image.
So how can I keep a button visible and functioning ?

My code is like following :

protected void Page_Load(object sender, EventArgs e)

// db connection, byte array create etc..

Response.binaryWrite(objdata);
Response.End();





我尝试过:



我尝试在页面上创建一些div,但没有成功。



What I have tried:

I tried creating some divs ın the page, no success.

推荐答案

当然可以。你没有发送带有上下文的mime类型,因此默认情况下每个浏览器都将它视为文本。



mime类型告诉浏览器内容是什么您要发送回来以便它可以弄清楚如何处理它。



您必须使用适当的mime类型字符串为内容设置Repsonse.ContentType你正在返回,比如application / pdf,image / png等等。
Of course it does. You didn't send a mime type with the context so every browser si going to treat it as text by default.

The mime type tells the browser what the content is that you're sending back so it can figure out what to do with it.

You have to set the Repsonse.ContentType with an appropriate mime type string for the content you're returning, such as "application/pdf", "image/png", or whatever.


我实际上有:Response.ContentType =application / pdf;

否则它不显示pdf文件。尽管如此,按钮仍然是隐藏的。
I actually have : Response.ContentType = "application/pdf";
otherwise it does not display the pdf file. Despite this the button is hidden.


这篇关于Binarywrite方法填充整个页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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