[英]How to prevent postback on asp button while displaying a popup using JQuery
[英]having an asp back button in popup window for displaying pdf
我有一個用於顯示pdf的彈出窗口。但是我需要在彈出窗口中放置一個asp按鈕,嘗試了以下代碼,但找不到解決方案..有人可以解決嗎?
enter code here
<asp Page attributes>
...............
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<br />
<form id="form1" runat="server">
<div> <asp:Button ID="dd" runat="server" OnClick="Backonclick" Text="back"/>
</div>
<div></div>
</form>
</body>
</html>
on page load event
dd.Visible = true;
string path = Request.QueryString["val"].ToString();
string extention = Path.GetExtension(path);
int len = extention.Length - 1;
string extwithoutdot = extention.Substring(1, len);
if (extwithoutdot.Equals("JPG") || extwithoutdot.Equals("jpg") ||
extwithoutdot.Equals("jpeg") || extwithoutdot.Equals("JPEG"))
{
extwithoutdot = "jpeg";
...........
這里的問題是您要混合兩種不同類型的文檔。 PDF是一種下載類型,而HTML是另一種下載類型。 不幸的是,一次下載不能兼而有之,並且您不能部分中途切換文檔類型,也不能期望瀏覽器能夠處理它。
對於您所追求的最簡單的解決方案是將兩者結合在客戶端。 將彈出窗口加載為HTML頁面(如果需要,由ASP.NET生成),並在其中包含一個鏈接到PDF生成腳本的IFRAME
; 形式:
<html>
<body>
<a class='button' href="javascript:window.close()">Close</a>
<iframe src="generatePdf.aspx" height="300" width="300" />
</body>
</html>
我有解決方案
<form id="form1" runat="server">
<iframe src="Copy (2) of DisplayPdf.aspx" width="1000" height="400">
</iframe>
<iframe src="Copy of DisplayPdf.aspx" width="100" height="200">
</iframe>
</form>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.