Reputation: 2014
I have page1.aspx witch is content page. On this page, on click event is triggered:
$("#lnkConsent").click(function (e) {
var dlg = $("#divConsent").dialog();
dlg.load('page2.aspx').dialog('open');
});
html:
<div id="divConsent" title="Consent" class="UniversalDialog"></div>
Page page2.aspx is an empty page, standard web form no serverside forms or heads:
<html xmlns="http://www.w3.org/1999/xhtml">
<head >
<title></title>
</head>
<body>
<form id="form1" > <div></div> </form>
</body>
</html>
C# code behind on page Page_Load:
Response.ContentType = "image/jpeg";
Response.Clear ( );
Response.BufferOutput = true;
Response.WriteFile ( Path.Combine ( Server.MapPath ( "~/foldername" ), filename);
Response.Flush ( );
Response.End ( );
When page2.aspx is called through address bar it works correctly: image is displayed but, when I try to load this page in dialog on Page1.aspx result is as is shown below:
Ofcourse, I would like to show this flushed picture in jQuery dialog loading page2.aspx in it.
What is my problem?
What I'm missing?
Upvotes: 0
Views: 246
Reputation: 56688
The load
function you are using expects HTML back, which it never receives. Instead what you might want to do is to create an image tag with source as page2.aspx
and then set it as a dialog content. Something along these lines (just an idea though, might need some adjustment):
$("#lnkConsent").click(function (e) {
var dlg = $("#divConsent").dialog();
var image = $('<img src="page2.aspx"/>');
dlg.html(image).dialog('open');
});
Upvotes: 1