string url = Invoice.aspx?InvoiceID=" + strInvoiceID.ToString() + "&";
string str = Guid.NewGuid().ToString();
str = str.Replace('-', '0');
str = 'w' + str;
System.Text.StringBuilder sb = new System.Text.StringBuilder();
sb.Append(@"<script language='javascript'>");
sb.Append(@"PopWin('" + url + "','" + str + "', 'CallingFormName.aspx', '', '1024', '620');");
sb.Append(@"</script>");
System.Web.UI.ScriptManager.RegisterStartupScript(this, this.GetType(), "JCall1", sb.ToString(), false);
// Write following function in script block of .aspx page
function PopWin(varURL, varWindowName, varCaller, varKeyId, varWidth, varHeight) {
var objTransparent = document.getElementById("Transparent");
var height = document.body.clientHeight + 'px';
document.documentElement.scrollTop = 0;
if (navigator.appName == "Microsoft Internet Explorer")
objTransparent.style.height = "100%";
else
objTransparent.style.height = height;
objTransparent.style.width = "100%";
objTransparent.style.visibility = 'visible';
var varLeft = (screen.width / 2) - (varWidth / 2);
var varTop = (screen.height / 2) - (varHeight / 2);
popupWindow = window.open(varURL + 'Caller=' + varCaller + '&Id=' + varKeyId + '&ShowModal=1', varWindowName, 'width=' + (screen.width - 10) + 'px; height=' + (screen.height - 70) + 'px; top=' + 0 + '; left=' + 0 + '; location=0 ;resizable=1; scrollbars=1');
}