c# pop pencere açmak ve bu pencere içinde bir asp.net sayfası gösterme
1)Önce head arasına javascript ekliyoruz.
<head runat="server">
<title></title>
<script>
function PopupCenter(url, title, w, h) {
var child;
var timer;
var guid;
var dualScreenLeft = window.screenLeft != undefined ? window.screenLeft : screen.left;
var dualScreenTop = window.screenTop != undefined ? window.screenTop : screen.top;
width = window.innerWidth ? window.innerWidth : document.documentElement.clientWidth ? document.documentElement.clientWidth : screen.width;
height = window.innerHeight ? window.innerHeight : document.documentElement.clientHeight ? document.documentElement.clientHeight : screen.height;
var left = ((width / 2) - (w / 2)) + dualScreenLeft;
var top = ((height / 2) - (h / 2)) + dualScreenTop;
child = window.open(url, title, 'scrollbars=yes, width=' + w + ', height=' + h + ', top=' + top + ', left=' + left);
if (child.focus) {
child.focus();
parent.location.assign('');// Change parent Page location
}
}
</script>
</head>
2)Daha sonra sayfamıza kodumuzu ekliyoruz.
protected void Button1_Click(object sender, EventArgs e)
{
Page.ClientScript.RegisterStartupScript(this.GetType(), "CallMyFunction", "PopupCenter('http://78.186.45.81:2160/login.aspx', 'Widow Title', '1000', '1000');", true);
}
<head runat="server">
<title></title>
<script>
function PopupCenter(url, title, w, h) {
var child;
var timer;
var guid;
var dualScreenLeft = window.screenLeft != undefined ? window.screenLeft : screen.left;
var dualScreenTop = window.screenTop != undefined ? window.screenTop : screen.top;
width = window.innerWidth ? window.innerWidth : document.documentElement.clientWidth ? document.documentElement.clientWidth : screen.width;
height = window.innerHeight ? window.innerHeight : document.documentElement.clientHeight ? document.documentElement.clientHeight : screen.height;
var left = ((width / 2) - (w / 2)) + dualScreenLeft;
var top = ((height / 2) - (h / 2)) + dualScreenTop;
child = window.open(url, title, 'scrollbars=yes, width=' + w + ', height=' + h + ', top=' + top + ', left=' + left);
if (child.focus) {
child.focus();
parent.location.assign('');// Change parent Page location
}
}
</script>
</head>
2)Daha sonra sayfamıza kodumuzu ekliyoruz.
protected void Button1_Click(object sender, EventArgs e)
{
Page.ClientScript.RegisterStartupScript(this.GetType(), "CallMyFunction", "PopupCenter('http://78.186.45.81:2160/login.aspx', 'Widow Title', '1000', '1000');", true);
}
Hiç yorum yok