default.aspx
html code:
<form id="form1" runat="server">
<div>
Focus to open a popup :
<asp:TextBox ID="txtOpenPopup" runat="server" onkeydown="OpenPopup()" onmousedown="OpenPopup()" />
<br />
<br />
<asp:FileUpload ID="FileUpload1" runat="server" />
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="pREVIEW" />
<br />
<br />
<br />
<asp:ImageButton ID="ImageButton1" runat="server" onkeydown="OpenPopup()" onmousedown="OpenPopup()" Height="70px" ImageUrl="~/images/beauty (9).jpg" />
<br />
<script language="javascript">
function OpenPopup() {
popup("PopupPage.aspx");
}
</script>
<script>
function popup(url) {
var width = 600;
var height = 400;
var left = (screen.width - width) / 2;
var top = (screen.height - height) / 2;
var params = 'width=' + width + ', height=' + height;
params += ', top=' + top + ', left=' + left;
params += ', directories=no';
params += ', location=no';
params += ', menubar=no';
params += ', resizable=no';
params += ', scrollbars=no';
params += ', status=no';
params += ', toolbar=no';
newwin = window.open(url, 'windowname5', params);
if (window.focus) { newwin.focus() }
return false;
}
</script>
</div>
</form>
button:
FileUpload1.SaveAs(Server.MapPath("images/")+FileUpload1.FileName);
string s = "images/" + FileUpload1.FileName;
ImageButton1.ImageUrl=s;
Session["a"] = s;
popup.aspx:
form load:
Image1.ImageUrl = Session["a"].ToString();