2014-04-03 41 views
0

我有page1.aspx女巫是内容页面。在这个页面上,点击上触发事件:在jQuery对话框中加载带有刷新图像的aspx页面

$("#lnkConsent").click(function (e) { 
    var dlg = $("#divConsent").dialog(); 
    dlg.load('page2.aspx').dialog('open'); 
}); 

HTML:

<div id="divConsent" title="Consent" class="UniversalDialog"></div> 

page2.aspx是一个空白页,标准的Web表单服务器端没有任何形式或头:

<html xmlns="http://www.w3.org/1999/xhtml"> 
<head > 
    <title></title> 
</head> 
<body> 
    <form id="form1" > <div></div> </form> 
</body> 
</html> 

C#代码隐藏页面上的Page_Load:

Response.ContentType = "image/jpeg"; 
Response.Clear (); 
Response.BufferOutput = true; 
Response.WriteFile (Path.Combine (Server.MapPath ("~/foldername"), filename); 
Response.Flush (); 
Response.End (); 

page2.aspx通过地址栏称之为正常工作:图像显示 但是,当我尝试在加载对话框此页面Page1.aspx的结果为如下所示:

enter image description here

当然,我想在jQuery对话框中加载page2.aspx来显示这个刷新的图片。

我的问题是什么?

我失踪了什么?

回答

1

您使用的load函数期望HTML返回,它永远不会收到。相反,您可能想要做的是创建一个源代码为page2.aspx的图像标记,然后将其设置为对话框内容。某些沿着这些线(只是一个想法,但可能需要一些调整):

$("#lnkConsent").click(function (e) { 
    var dlg = $("#divConsent").dialog(); 
    var image = $('<img src="page2.aspx"/>');  
    dlg.html(image).dialog('open'); 
}); 
+0

先生,你是genious! – dllhell

相关问题